iterators (was: python-dev summary)

Kevin Digweed kevin.digweed at dial.pipex.com
Sun Feb 18 14:26:19 EST 2001


Erno Kuusela wrote:
> 
> In article <96ipv7$hug$2 at nntp9.atl.mindspring.net>, "Andrew Dalke"
> <dalke at acm.org> writes:
> 
> | Grant Griffin:
> || However...
> ||
> || I regret Python's increasing loss of status as "executable
> || pseudo-code".  This proposal, as well as 2.0's "list comprehensions",
> || seem to be making Python harder for the uninitiated to read.  (To be
> || fair, though, as a "moderately-initiated" Pythoneer, I've recently
> || warmed up to list comprehensions.)
> || [more comments removed]
> 
> | I admit to a "Me too!" here.
> 
> me three!
> 
> actually, the first time i saw the proposal for
> 
> for key:value in dict:
>     ...
> 
> i thought it was a joke. ok, it's not obscure, but i
> don't see the point either.

Sadly, I don't Python as much as I used to, but as someone who has
started reading the newsgroup again since just after 2.0 was released,
this PEP did come as something of a surprise to me. I don't think that
the 'for x:y in dict' syntax bothered me so much as the 'for :y' and
'for x:' variants. It's too subtle. I saw a post recently where someone
did "(None, None, None, ThingIWant, OtherThingIWant, None) =
funcreturning6_tuple();". I confess to doing something similar when I
first started Python. I expected None to be something that, given it's
name, was something of a black hole. The solution is to assign all those
things you don't want to a dummy name which you can subsequently
'del'ete.
I think that the proposed extension to the 'for' syntax should be
limited to *only* the "x:y" variety. If you don't want the left or right
component, you assign it to a dummy name and 'del'ete it if neccessary.

OTOH, if the other variations on the 'for' syntax were to be allowed, I
think that "for (,,, ThingIWant, OtherthingIWant,,) =
funcreturning6_tuple();" should also be allowed. (BTW, I'm being
sarcastic).

I guess that what I'm saying is that I don't think the *absense* of a
word/keyword should be treated as significant.

Kev.



More information about the Python-list mailing list