[Python-Dev] Iteration variables and list comprehensions

Tim Peters tim_one@email.msn.com
Thu, 31 May 2001 02:20:21 -0400


[Greg Ewing]
> If we do this, we also need to consider whether we want
> to make the corresponding change to regular for-loops.
> Seems to me that all the reasons it's a good idea for
> listcomps apply to for-loops as well.

I expect there's no chance:  unlike listcomps, for-loops allow break
statements, and search loops that use the for index after a break (and out
of the loop!) are common.

> Another advantage of changing both together is that
> we can continue to describe listcomp semantics in terms
> of for-loops

But I'm afraid that's also an advantage of leaving both alone.

> instead of lambdas.
>
> Then we won't have to go into hiding until Guido dies or lifts
> the fatwah against us.

Death won't stop him -- he's Dutch <wink>.