[docs] [issue17546] Document the circumstances where the locals() dict gets updated

Terry J. Reedy report at bugs.python.org
Sat Mar 30 06:34:08 CET 2013


Terry J. Reedy added the comment:

After the last exchange on #7083, Guido emailed me that I could/should revised the doc a bit, but he said he did *not* want the details explained because he regards them as CPython implementation details and not part of the language definition. I have not done so yet because of other issues, especially the Idle PEP and related discussion. What is needed is something like

"The relationship between the local namespace and the locals dict is undefined between calls to locals(). Changes to either may or may not be propagated to the other."

Perhaps add "The dict returned by locals() is intended to be used immediately, either for introspection or for passing on to functions such as eval() and exec()." and even "It is not intended to be saved and used later."

What I have not figured out yet is how to integrate the above with the current text.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue17546>
_______________________________________


More information about the docs mailing list