def foo(): def bar(): print x # x bound to outer function print y # y not known, use normal scoping rules (global) x = 4
def foo(): def bar(): print x exec "x = 4" # Whoa!