New submission from Ivan Pozdeev: It appears that the interpreter assigns an identifier to local or global scope at compilation time rather than searching locals, then globals (i.e. vars()) at the time of execution.
An example: >>> def test(): ... vars()['a']=1 ... print(a) ... >>> test() Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 3, in test NameError: global name 'a' is not defined >>> ---------- components: Interpreter Core messages: 200004 nosy: native_api priority: normal severity: normal status: open title: Local variable created with reflection cannot be referenced with identifier type: behavior versions: Python 2.6, Python 2.7, Python 3.1, Python 3.2, Python 3.3 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue19268> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com