[Python-ideas] Is this PEP-able? for X in ListY while conditionZ:

Andrew Barnert abarnert at yahoo.com
Thu Jun 27 19:54:50 CEST 2013


On Jun 27, 2013, at 5:19, Nick Coghlan <ncoghlan at gmail.com> wrote:

> FWIW, while I actually agree with you that "else return" doesn't fit
> because people *think* of comprehensions and generator as loops rather
> than as nested functions, they *are* defined as following the scoping
> rules of a nested function and CPython actually implements them that
> way:

I thought it was decided to explicitly add comprehensions as a new place that defines a scope, to avoid the confusion of calling them functions?

I may be remembering wrong; I'll read over the docs later. 


More information about the Python-ideas mailing list