Incorrect scope of list comprehension variables

Gregory Ewing greg.ewing at
Wed Apr 7 01:13:49 CEST 2010

Lie Ryan wrote:
> in python there is only a flat
> local namespace and the names resolver becomes a thousand times simpler

No, it doesn't. The compiler already has to deal with multiple
scopes for nested functions. There may be some simplification,
but not a lot.

The main reason is linguistic. Having nested blocks create new
scopes does not fit well with lack of variable declarations.


More information about the Python-list mailing list