[Python-Dev] 2.5 and beyond
Phillip J. Eby
pje at telecommunity.com
Sun Jul 2 16:07:57 CEST 2006
At 01:58 PM 7/2/2006 +0200, jan-python at maka.demon.nl wrote:
>I believe the problem has nothing to do with how many scopes a block/function
>definition has, but with what the lambda does with the scope it's given.
>Currently it remembers the block and looks up the nescessary variables in it
>when it's invoked. I think it shoud should have just taken the values of the
>needed variables and rememberd those as it's own local variables. So
>the closed
>over variables become just local variables initialised to the value
>they have in
>the outer scope.
That won't work. Consider this code, that's perfectly valid Python today:
def foo():
def bar():
print x
for x in range(10):
bar()
More information about the Python-Dev
mailing list