homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Mark.Janssen
Recipients Mark.Janssen
Date 2012年08月11日.00:19:17
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1344644361.49.0.381165931673.issue15621@psf.upfronthosting.co.za>
In-reply-to
Content
>>> 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?
History
Date User Action Args
2012年08月11日 00:19:22Mark.Janssensetrecipients: + Mark.Janssen
2012年08月11日 00:19:21Mark.Janssensetmessageid: <1344644361.49.0.381165931673.issue15621@psf.upfronthosting.co.za>
2012年08月11日 00:19:20Mark.Janssenlinkissue15621 messages
2012年08月11日 00:19:17Mark.Janssencreate

AltStyle によって変換されたページ (->オリジナル) /