[issue32413] Document that locals() may return globals()

Raymond Hettinger report at bugs.python.org
Sat Dec 23 03:12:02 EST 2017


Raymond Hettinger <raymond.hettinger at gmail.com> added the comment:

FWIW, this isn't a quirk of how locals() works.  Instead, it reflects the more interesting reality that at the top level, locals and globals *are* the same dictionary.   Also, that is not the only occurrence -- if exec() is called with only one dictionary, that dict is used for both locals and globals.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32413>
_______________________________________


More information about the Python-bugs-list mailing list