[Python-Dev] PEP 3142: Add a "while" clause to generator expressions

Kristján Valur Jónsson kristjan at ccpgames.com
Mon Jan 19 22:28:39 CET 2009


Are you all certain that this mapping from a generator expression to a foor loop isn't just a happy coincidence?
After all, the generator statement is just a generalization of the list comprehension and that doesn't map quite so directly.

I have always taken both expressions at face value, and not tried to map them into something else.  Why should you, since they are designed to match the grammar of the english language and make perfect sense if you read them as you would a herring recipe.
The suggested "while" keyword expands on this easy to understand theme, and the fact that it doesn't fit a mapping that was probably never intentional shouldn't detract from that.

K


-----Original Message-----
From: python-dev-bounces+kristjan=ccpgames.com at python.org [mailto:python-dev-bounces+kristjan=ccpgames.com at python.org] On Behalf Of Terry Reedy
Sent: 19. janúar 2009 17:52
To: python-dev at python.org
Subject: Re: [Python-Dev] PEP 3142: Add a "while" clause to generator expressions


The other, posted by Steven Bethard, is that it fundamentally breaks the 
current semantics of abbreviating (except for iteration variable 
scoping) an 'equivalent' for loop.  This should have been listed in the 
PEP under Objections (or whatever the section.  I did not bother to 
second his objection there but will now.

-1



More information about the Python-Dev mailing list