New submission from vid podpecan <vid.podpe...@gmail.com>: Consider the following two functions:
def outer(): a = 1 def inner(): print a inner() #end outer() def outer_BUG(): a = 1 def inner(): print a a = 2 inner() #end outer_BUG() The first function outer() works as expected (it prints 1), but the second function ends with an UnboundLocalError, which says that the "print a" statement inside inner() function references a variable before assignment. Somehow, the interpreter gets to this conclusion by looking at the next statement (a = 2) and forgets the already present variable a from outer function. This was observed with python 2.5.4 and older 2.5.2. Other releases were not inspected. Best regards, Vid ---------- messages: 85992 nosy: vpodpecan severity: normal status: open title: scope resolving error type: behavior versions: Python 2.5 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5763> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com