Marco Buttu added the comment:
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
----------
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue28853>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com