I didn't want to start a discussion, I was more concerned if I got the semantic (that I should impl) right. So: x=7 def f(): x=1 def g(): global x def h(): return x return h() return g()
and then print f() as main, right?
will print 1. Ok.
regards.
Argh! I honestly don't know what this ought to do. Under the rules as I currently think of them this would print 1. But that's at least surprising, so maybe we'll have to revisit this. Jeremy, also please note that if I add "from __future__ import nested_scopes" to the top, this dumps core, saying: lookup 'x' in g 2 -1 Fatal Python error: com_make_closure() Aborted (core dumped) Maybe you can turn this into a regular error? <0.5 wink>
PS: I tried this with a2 and python just died, I imagine, this has been fixed.
Seems so. :-) --Guido van Rossum (home page: http://www.python.org/~guido/)