I should admit that I like the idea of nested scopes, because I like functional programming style, but I don't know whether this returning 3 is nice ;)?
def f(): def g(): return y # put as many innoncent code lines as you like y=3 return g()
This is a red herring; I don't see how this differs from the confusion in
def f(): print y # lots of code y = 3
and I don't see how nested scopes add a new twist to this known issue.
It really seems that there's not been enough discussion about the change,
and I think that is also ok to honestely be worried about what user will feel about this? (and we can only think about this beacuse the feedback is not that much)
Will this code breakage "scare" them and slow down migration to new versions of python? They are already afraid of going 2.0(?). It is maybe just PR matter but ...
The *point* is that we are not going from version 0.8 to version 0.9 of our toy research lisp dialect, passing from dynamic scoping to lexical scoping. (Yes, I think, that changing semantic behind the scene is not a polite move.)
Well, I'm actually glad to hear this -- Python now has such a large user base that language changes are deemed impractical.
We really need the BDFL proposing the right thing.
We'll discuss this more at the PythonLabs group meeting. For now, I prefer to move forward with nested scopes, breaking code and all.
--Guido van Rossum (home page: http://www.python.org/%7Eguido/)