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

R. David Murray report at bugs.python.org
Thu Jan 15 15:59:23 CET 2015


R. David Murray added the comment:

Yeah, the question of thread-safety in regards to what we are talking about here also occurred to me.  That is, the wording makes one wonder if locals is thread safe or not.  I don't see your suggested wording as making it clearer, though.

The problem is that it *is* underspecified.

So I think the correct description of the current under-specification is that locals() returns a copy of the current locals namespace.  If you modify the thing returned by locals it may or may not update the local namespace.  If you modify the local namespace (by doing x = y or its equivalents) the change may or may not be reflected in the object that was returned by locals().

Now, how do we boil that down?  Or do we just say it more or less that way?

----------

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


More information about the docs mailing list