[docs] [issue28853] locals() and free variables

Xavier de Gaye report at bugs.python.org
Fri Dec 2 15:19:55 EST 2016

Xavier de Gaye added the comment:

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:

[2] https://docs.python.org/3/reference/datamodel.html#the-standard-type-hierarchy

nosy: +xdegaye

Python tracker <report at bugs.python.org>

More information about the docs mailing list