Peng Yu wrote: > Hi, In many other functional language, one can change the closure of a > function.
Which are those languages, and how do they work? And is Python actually a "functional language"? > Is it possible in python? I'm not sure what you mean. Something like >>> def f(x): ... def g(y): ... return x + y ... def h(newx): ... nonlocal x ... x = newx ... return g, h ... >>> a, b = f(10) >>> a(42) 52 >>> b(20) >>> a(42) 62 ? > http://ynniv.com/blog/2007/08/closures-in-python.html A short explanation would have been better than that link. -- https://mail.python.org/mailman/listinfo/python-list