[Python-Dev] Tricky way of of creating a generator via a comprehension expression

Greg Ewing greg.ewing at canterbury.ac.nz
Thu Nov 23 17:29:51 EST 2017


Guido van Rossum wrote:
> the extra scope is now part of the language definition. 
> It can't be removed as a "bug fix".

Does anyone actually rely on the scope-ness of comprehensions
in any way other than the fact that it prevents local variable
leakage?

If not, probably nobody would notice if it were changed back.

-- 
Greg


More information about the Python-Dev mailing list