Marco Buttu added the comment:
In addition, also if here "function blocks" means nested function, the sentence
"Free variables are returned by locals() when it is called in function blocks"
I think is wrong. It is true only in case of free variables belonging to the
local enclosing scope. For instance, in the following case ``x`` is free in
``moo()``, but it is not in ``locals()``::
>>> x = 10
>>> def foo():
... def moo():
... print(x)
... print(locals())
... return moo
...
>>> moo = foo()
>>> moo()
10
{}
I attach a patch with a new description and an example.
PS. Is the rst rendered by Sphinx? In that case, why we are not using the
doctest Sphinx extension to test the code examples?
----------
keywords: +patch
Added file: http://bugs.python.org/file45732/locals_func.patch
_______________________________________
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