[issue10043] UnboundLocalError with local variable set by setattr, caused by code run later
Eric Smith
report at bugs.python.org
Thu Oct 7 13:31:52 CEST 2010
Eric Smith <eric at trueblade.com> added the comment:
When python sees the assignment "name = None", it assumes that 'name' is a local variable. This happens before any code is executed. It then sees that you're printing 'name' before it is assigned to, which is an error. It does not take into account the dynamic creation of the module level variable.
----------
nosy: +eric.smith
resolution: -> invalid
status: open -> closed
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue10043>
_______________________________________
More information about the Python-bugs-list
mailing list