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

Sturla Molden sturla at molden.no
Mon Jan 19 20:29:31 CET 2009

On 1/19/2009 6:51 PM, Terry Reedy wrote:

> 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. 

The proposed syntax would suggest that this should be legal as well:

for i in iterable while cond:

or perhaps:

while cond for i in iterable:

A while-for or for-while loop would be a novel invention, not seen in 
any other language that I know of. I seriously doubt its usefulness 

Sturla Molden

More information about the Python-Dev mailing list