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.
Created on 2010年06月21日 19:46 by Andreas Hofmeister, last changed 2022年04月11日 14:57 by admin. This issue is now closed.
| Messages (2) | |||
|---|---|---|---|
| msg108307 - (view) | Author: Andreas Hofmeister (Andreas Hofmeister) | Date: 2010年06月21日 19:46 | |
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 |
|||
| msg108308 - (view) | Author: Andreas Hofmeister (Andreas Hofmeister) | Date: 2010年06月21日 19:51 | |
Duplicate of 9049. Sorry for the inconvenience. |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022年04月11日 14:57:02 | admin | set | github: 53296 |
| 2010年06月21日 19:52:02 | eric.araujo | set | resolution: duplicate stage: resolved |
| 2010年06月21日 19:51:25 | Andreas Hofmeister | set | status: open -> closed messages: + msg108308 |
| 2010年06月21日 19:46:39 | Andreas Hofmeister | create | |