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

Nick Coghlan report at bugs.python.org
Mon Jun 29 09:39:56 CEST 2015

Nick Coghlan added the comment:

I mostly like Martin's suggested wording, but would also note that I filed issue 17960 to tighten up the requirements for when we expect assigning to locals() to work.

To save folks reading the whole referenced email, I think it would be worth defining that modifying the namespace returned by locals() will affect the runtime namespace at module and class scope and when using exec, but will have no effect at function scope (as locals() returns a copy of the namespace in that case).


Python tracker <report at bugs.python.org>

More information about the docs mailing list