1 a = 4 2 3 def f(x): 4 def g(): 5 def h(z): 6 return x, y, z, a 7 h(3) # NameError in Python 8 y = 2 # not available for h, detected during inspection 9 return h 10 return g 11 12 result = f(1)()(3) 13 assert result == (1, 2, 3, 4)