anatoly techtonik added the comment:

I'm 3rd to vote for reopening this issue to clarify documentation or to fix 
(read below).

== Why it is important to fix
1. First personal user story. Until I saw the localstest.py I couldn't figure 
out what all locals() definitions are talking about. Dictionary, that is a 
copy, but the copy is sporadically updated when nobody is using in background. 
It is a weird dictionary with inconsistent behavior placed at a rather critical 
part of the language.

2. Second personal story. I probably run into the same bug in issue16781. 
Probably, because I still don't understand what really happens. It is only a 
suspicion, and it is bad because with my experience I'm supposed to know what 
happens, but I never had the time to dig deeper until now.

3. locals() is referenced in exec/execfile() docs for the explanation of 
arguments. Magic of locals() multiplied by exec.execfile() gives a next level 
of headache when you need to resolve this. Add settrace() to the formula to 
awake a hater in you.

exec/execfile() are used in Python-based scripting tools (such as SCons), in 
trace scripts and when Python is embedded as a scripting language. Coding on 
this level should be easy to make more interesting tools to appear.

== Fix Idea 
1. Is it possible to rename locals() to _locals(), and leave user visible API 
function local() for an object that updates itself every time it is accessed?

----------
components: +Documentation
nosy: +techtonik
versions: +Python 2.7

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7083>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to