In article <[EMAIL PROTECTED]>, Nick Coghlan <[EMAIL PROTECTED]> wrote:
Antoon Pardon wrote:ons already existing.
The compilor might generate a RESTORE instruction.
Whether it is done as a LOAD/STORE or a RESTORE, it has to perform the same work - check the name exists in the local namespace, and throw an exception if it doesn't. If it the name does exist, perform a normal store operation.
But the compiler would _know_ in which scope the variable was defined, no?
I wouldn't expect the behaviour of name rebinding to be any different from other forms of augmented assignment as far as the existence of the left-hand side goes.
Py> def f(): ... x += 1 ... Py> f() Traceback (most recent call last): File "<stdin>", line 1, in ? File "<stdin>", line 2, in f UnboundLocalError: local variable 'x' referenced before assignment
-- Nick Coghlan | [EMAIL PROTECTED] | Brisbane, Australia --------------------------------------------------------------- http://boredomandlaziness.skystorm.net -- http://mail.python.org/mailman/listinfo/python-list