New submission from Andreas Hofmeister <andreas.hofmeis...@yahoo.de>:
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 ---------- components: Interpreter Core messages: 108307 nosy: Andreas Hofmeister priority: normal severity: normal status: open title: UnboundLocalError in nested function type: behavior versions: Python 2.5, Python 2.6 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue9050> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com