This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author r.david.murray
Recipients holdenweb, r.david.murray
Date 2014-07-02.12:06:21
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1404302781.63.0.588123901269.issue21904@psf.upfronthosting.co.za>
In-reply-to
Content
Yeah, closures can be a bit counter-intuitive.  Assuming *I'm* understanding this correctly, the closure captures a pointer to the local variable, not the value of the local variable, and thus keeps it alive.  (That is, the namespace is not destroyed until all closures referencing it have gone away.)

https://docs.python.org/3/faq/programming.html#why-do-lambdas-defined-in-a-loop-with-different-values-all-return-the-same-result
History
Date User Action Args
2014-07-02 12:06:21r.david.murraysetrecipients: + r.david.murray, holdenweb
2014-07-02 12:06:21r.david.murraysetmessageid: <1404302781.63.0.588123901269.issue21904@psf.upfronthosting.co.za>
2014-07-02 12:06:21r.david.murraylinkissue21904 messages
2014-07-02 12:06:21r.david.murraycreate