[issue13827] Unexecuted import changes namespace
Ezio Melotti
report at bugs.python.org
Thu Jan 19 17:08:35 CET 2012
Ezio Melotti <ezio.melotti at gmail.com> added the comment:
>>> OVERRIDE = False
>>> SOMETHING = "original"
>>>
>>> def main():
... if OVERRIDE:
... SOMETHING = None
... print SOMETHING
...
>>> main()
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<stdin>", line 4, in main
UnboundLocalError: local variable 'SOMETHING' referenced before assignment
http://docs.python.org/faq/programming.html#why-am-i-getting-an-unboundlocalerror-when-the-variable-has-a-value
----------
nosy: +ezio.melotti
resolution: invalid ->
stage: committed/rejected ->
status: closed -> open
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue13827>
_______________________________________
More information about the Python-bugs-list
mailing list