x = 10

def f():
    x = 6
    def g():
        print x     # x resolves to the enclosing scope
    g()

f()