foo = 0 def outer(): def inner(): global foo print(foo) inner() outer()