A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2001-February/012631.html below:

[Python-Dev] re: Sets BOF / for in dict

[Python-Dev] re: Sets BOF / for in dictKa-Ping Yee ping@lfw.org
Mon, 5 Feb 2001 11:15:18 -0800 (PST)
On Mon, 5 Feb 2001, M.-A. Lemburg wrote:
> Two things: 
> 
> 1. the proposed syntax key:value does away with the
>    easy to parse Python block statement syntax

Oh, come on.  Slices and dictionary literals use colons too,
and there's nothing wrong with that.  Blocks are introduced
by a colon at the *end* of a line.

> 2. why can't we use the old 'for x,y,z in something:' syntax
>    and instead add iterators to the objects in question ?
> 
>    for key, value in object.iterator():
>       ...

Because there's no good answer for "what does iterator() return?"
in this design.  (Trust me; i did think this through carefully.)
Try it.  How would you implement the iterator() method?

The PEP *is* suggesting that we add iterators to the objects --
just not that we explicitly call them.  In the 'for' loop you've
written, iterator() returns a sequence, not an iterator.


-- ?!ng





RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4