I'm confused. What is the definition of closure. I'm not sure if it's correct, I get the definition from wikipedia:
"A closure typically comes about when one function is declared entirely within the body of another, and the inner function refers to local variables of the outer function. At runtime, when the outer function executes, a closure is formed. It consists of the inner function's code and references to any variables in the outer function's scope that the closure needs." I agree it is not declaration, it's definition. However it's closure based on the above definition. It uses free variable. Or you mean it's a closure only when the outer function returns it and be exposed to external world? The code snippet was just for test purpose. My question was how the free variable inside inner function (the closure) binds with object. That was answered by Fredrik perfectly. -- http://mail.python.org/mailman/listinfo/python-list