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.14:47:31
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1404312451.63.0.459617738553.issue21904@psf.upfronthosting.co.za>
In-reply-to
Content
This is a specific instance of the general principle that a python variable is a 'named' location that holds a pointer to an arbitrary python object.  The 'name' in this case is the variable name that appears in multiple scopes (which is what triggers the creation of the cell object...I have no idea at what point in the process it is created).  To create a *new* cell object at closure creation time (which is essentially what you are advocating if I understand correctly) would, I think, change the semantics of Python's scoping rules.  It would mean that the behavior would be different depending on whether or not 'nonlocal' was specified...if it is nonlocal, the behavior *has* to be the current behavior.
History
Date User Action Args
2014-07-02 14:47:31r.david.murraysetrecipients: + r.david.murray, holdenweb
2014-07-02 14:47:31r.david.murraysetmessageid: <1404312451.63.0.459617738553.issue21904@psf.upfronthosting.co.za>
2014-07-02 14:47:31r.david.murraylinkissue21904 messages
2014-07-02 14:47:31r.david.murraycreate