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.