[New-bugs-announce] [issue19268] Local variable created with reflection cannot be referenced with identifier
Ivan Pozdeev
report at bugs.python.org
Tue Oct 15 17:30:41 CEST 2013
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 <report at bugs.python.org>
<http://bugs.python.org/issue19268>
_______________________________________
More information about the New-bugs-announce
mailing list