1 a = 4 2 3 def f(x): 4 def g(y, x=x): 5 def h(a, z, x=x, y=y): 6 return x, y, z, a # parameter a overrides global scope 7 return h 8 return g 9 10 result = f(1)(2)(5, 3) 11 print result[0] 12 print result[1] 13 print result[2] 14 print result[3] 15 assert result == (1, 2, 3, 5)