1 a = 4 2 3 def f(x): 4 def g(y, x=x): 5 def h(z, x=x, y=y): 6 return x, y, z, a 7 return h 8 return g 9 10 fn = f(1) 11 print fn # __main__.f.$l0 12 print fn(2) # __main__.f.$l0.$l0 13 print fn(2)(3) # (1, 2, 3, 4) 14 print fn(2)(3, 5) # (5, 2, 3, 4) 15 print fn(2)(3, 5, 6) # (5, 6, 3, 4)