[New-bugs-announce] [issue15621] UnboundLocalError on simple in-place assignment of an inner scope
zipher
report at bugs.python.org
Sat Aug 11 02:19:21 CEST 2012
New submission from zipher:
>>> num = 1
>>> def t1():
print num
>>> t1()
1
>>> def t2():
... num+=1
... print num
>>> t2()
UnboundLocalError: local variable 'num' referenced before assignment
It seems num is bound in t1, but not t2, even though they are the same scope. Am I missing something?
----------
components: Interpreter Core
messages: 167928
nosy: Mark.Janssen
priority: normal
severity: normal
status: open
title: UnboundLocalError on simple in-place assignment of an inner scope
versions: Python 2.7
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue15621>
_______________________________________
More information about the New-bugs-announce
mailing list