[Python-Dev] nested scopes. global: have I got it right?

Samuele Pedroni pedroni@inf.ethz.ch
Thu, 1 Mar 2001 02:24:53 +0100


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()

will print 1. Ok.

regards.

PS: I tried this with a2 and python just died, I imagine, this has been fixed.