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 xdegaye
Recipients docs@python, marco.buttu, mdk, r.david.murray, xdegaye
Date 2016-12-02.20:19:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1480709995.95.0.234089529598.issue28853@psf.upfronthosting.co.za>
In-reply-to
Content
FWIW the definition of free variables can be found in the Language Reference at section 4.2.1. "Binding of names" [1].
The list of the free variables of a user defined function can be accessed through the __closure__ function attribute, a tuple. The function attributes are listed in the Language Reference
at section 3.2. "The standard type hierarchy" [2]. In the example given at msg282236, the value of x would be printed by the statement:
    print(moo.__closure__[0].cell_contents)

[1]https://docs.python.org/3/reference/executionmodel.html#naming-and-binding
[2] https://docs.python.org/3/reference/datamodel.html#the-standard-type-hierarchy
History
Date User Action Args
2016-12-02 20:19:55xdegayesetrecipients: + xdegaye, r.david.murray, docs@python, marco.buttu, mdk
2016-12-02 20:19:55xdegayesetmessageid: <1480709995.95.0.234089529598.issue28853@psf.upfronthosting.co.za>
2016-12-02 20:19:55xdegayelinkissue28853 messages
2016-12-02 20:19:55xdegayecreate