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 Andreas Hofmeister
Recipients Andreas Hofmeister
Date 2010年06月21日.19:46:37
SpamBayes Score 0.007829412
Marked as misclassified No
Message-id <1277149599.18.0.763779339646.issue9049@psf.upfronthosting.co.za>
In-reply-to
Content
Description:
An unexpected UnboundLocalError is produced when assigning a value to a variable inside a nested function. The first assignment to the variable is in the enclosing function.
Example:
def x():
 a = False
 def y():
 print a
 a = True
 return y
Calling x()() produces an UnboundLocalError on the 'print a' line.
If the 'a = True' line is removed, no error occurs.
Tested with:
 - 2.5.1
 - 2.6.5
Keywords: 
Nested function, UnboundLocalError, variable assignment
Thank you for your attention
History
Date User Action Args
2010年06月21日 19:46:39Andreas Hofmeistersetrecipients: + Andreas Hofmeister
2010年06月21日 19:46:39Andreas Hofmeistersetmessageid: <1277149599.18.0.763779339646.issue9049@psf.upfronthosting.co.za>
2010年06月21日 19:46:37Andreas Hofmeisterlinkissue9049 messages
2010年06月21日 19:46:37Andreas Hofmeistercreate

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