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 marco.buttu
Recipients docs@python, marco.buttu, martin.panter, mdk, r.david.murray, terry.reedy, xdegaye
Date 2016-12-03.12:25:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1480767903.47.0.496704743578.issue28853@psf.upfronthosting.co.za>
In-reply-to
Content
Martin, I removed the class blocks by accident. In any case, I reject the patch by myself, because to me the definition of "free variable" is not clear. 
The documentation [1] says: "If a variable is used in a code block but not defined there, it is a free variable." According to this description,  it seems to me that ``x`` is free both in ``foo()`` and in ``moo()``:


>>> def foo():
...     print(x)
...     def moo():
...         print(x)
...     return moo


But actually for the code object it is not:


>>> foo.__code__.co_freevars
()
>>> moo.__code__.co_freevars
('x',)


Thank you for your feedback, I will continue the discussion in issue 26683.

[1] https://docs.python.org/3/reference/executionmodel.html#naming-and-binding
History
Date User Action Args
2016-12-03 12:25:03marco.buttusetrecipients: + marco.buttu, terry.reedy, r.david.murray, docs@python, xdegaye, martin.panter, mdk
2016-12-03 12:25:03marco.buttusetmessageid: <1480767903.47.0.496704743578.issue28853@psf.upfronthosting.co.za>
2016-12-03 12:25:03marco.buttulinkissue28853 messages
2016-12-03 12:25:03marco.buttucreate