On Dec 12, 3:08 pm, Marc 'BlackJack' Rintsch <bj_...@gmx.net> wrote: > No bug because a mutation *is* attempted. ``a += x`` calls `a.__iadd__` > which *always* returns the result which is *always* rebound to the name > `a`. Even with mutable objects where `__iadd__()` simply returns > `self`!
No, a mutation is not attempted, even if __iadd__() always returns a value. If a rebinding of a member to the same member is attempted, the tuple should not raise an exception. The tuple should check that it is actually being *mutated* before it raises any exception. There is an attempted write to the tuple, but not an attempted mutation of the tuple. The tuple should tell the difference. Immutability does not imply inwriteability, if the write operation changes nothing. But the tuple raises an exception on any write attempt. -- http://mail.python.org/mailman/listinfo/python-list