Message282282
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 |
|
Date |
User |
Action |
Args |
2016-12-03 12:25:03 | marco.buttu | set | recipients:
+ marco.buttu, terry.reedy, r.david.murray, docs@python, xdegaye, martin.panter, mdk |
2016-12-03 12:25:03 | marco.buttu | set | messageid: <1480767903.47.0.496704743578.issue28853@psf.upfronthosting.co.za> |
2016-12-03 12:25:03 | marco.buttu | link | issue28853 messages |
2016-12-03 12:25:03 | marco.buttu | create | |
|