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 techtonik
Recipients eric.snow, techtonik
Date 2013-03-26.17:49:47
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1364320187.56.0.814854977413.issue17546@psf.upfronthosting.co.za>
In-reply-to
Content
Under the trace function, the dict is always updated, and that changed a workflow in the program I was debugging leading to heisenbug. But that's a different story. I'd like to concentrate on the reasons to rename locals() result type from 'dict' to 'livedict' (or other internal type with well-defined behavior).

dict() returned by locals() is sporadically updated. The problem is not with when it is updated, or how it is updated. The problem is that the fact that it is updated is not indicated in any way. And the problem that comes from this problem is that people don't realize that this dict may change its contents. As a result people become confused with Python.

The documentation is also ambiguous. Those people who don't know about self-updating behavior (I was) read "represents" like a "copy of symbol table", not like a "internally updated view of symbol table".

From the OOP point of view, the object doesn't behave like a normal dict, and it will be less confusing if it is renamed.


offtopic: "local execution namespace of a function call's stack frame" sounds cryptic - I am afraid that without visualization of local/global/namespace/scope/frame I am unable to understand that right now.

offtopic2: I also don't get "you should not expect changes to that dict to be reflected in the actual locals". I reads as if in some cases modifying the dict will change the locals. I thought that it is impossible as it is just a copy.
History
Date User Action Args
2013-03-26 17:49:47techtoniksetrecipients: + techtonik, eric.snow
2013-03-26 17:49:47techtoniksetmessageid: <1364320187.56.0.814854977413.issue17546@psf.upfronthosting.co.za>
2013-03-26 17:49:47techtoniklinkissue17546 messages
2013-03-26 17:49:47techtonikcreate