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
Date 2016-12-02.11:32:01
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1480678322.22.0.562226953352.issue28853@psf.upfronthosting.co.za>
In-reply-to
Content
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?
History
Date User Action Args
2016-12-02 11:32:02marco.buttusetrecipients: + marco.buttu, docs@python
2016-12-02 11:32:02marco.buttusetmessageid: <1480678322.22.0.562226953352.issue28853@psf.upfronthosting.co.za>
2016-12-02 11:32:02marco.buttulinkissue28853 messages
2016-12-02 11:32:02marco.buttucreate