[issue19268] Local variable created with reflection cannot be referenced with identifier
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: 24 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
[issue19268] Local variable created with reflection cannot be referenced with identifier
R. David Murray added the comment: Not really. But locals() is not reliably modifiable, and the vars documentation also notes this. -- nosy: +r.david.murray resolution: - invalid stage: - committed/rejected status: open - closed ___ 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
[issue19268] Local variable created with reflection cannot be referenced with identifier
Changes by Ethan Furman et...@stoneleaf.us: -- nosy: +ethan.furman resolution: invalid - stage: committed/rejected - status: closed - open ___ 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
[issue19268] Local variable created with reflection cannot be referenced with identifier
R. David Murray added the comment: Ethan, why did you reopen the issue? Do you have a different opinion, or was it just an issue-update error? -- ___ 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
[issue19268] Local variable created with reflection cannot be referenced with identifier
Ethan Furman added the comment: Oops! Issue update error, I was just adding myself to nosy as it looked like it was still open. Re-closing. -- resolution: - invalid stage: - committed/rejected status: open - closed ___ 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