Op 2005-11-03, Sybren Stuvel schreef <[EMAIL PROTECTED]>: > Antoon Pardon enlightened us with: >> I would expect a result consistent with the fact that both times b.a >> would refer to the same object. > > "b.a" is just a name, not a pointer to a spot in memory. Getting the > value associated with that name is something different from assigning > a new value to that name.
If that was all to it, one would expect the following to work to: >>> a = 1 >>> def f(): ... a += 2 ... >>> f() Traceback (most recent call last): File "<stdin>", line 1, in ? File "<stdin>", line 2, in f UnboundLocalError: local variable 'a' referenced before assignment But I'll word it differently: I would expect a result consistent with the fact that both times b.a would be resolved in the same name space. -- http://mail.python.org/mailman/listinfo/python-list