var or inout parm?
sturlamolden at yahoo.no
Fri Dec 12 09:30:43 EST 2008
On Dec 12, 3:08 pm, Marc 'BlackJack' Rintsch <bj_... at 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
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.
More information about the Python-list