inconsistency with += between different types ?

Donn Cave donn at
Mon Aug 5 21:50:25 CEST 2002

Quoth Jonathan Hogg <jonathan at>:
| On 5/8/2002 17:10, in article
| slrnakt9pu.c05.Andreas.Leitgeb at, "Andreas Leitgeb"
| <Andreas.Leitgeb at> wrote:
|> The question seems to be:
|> Is an extended assignment(*) a "modification" of an object or
|> a re-assignment to the left-side operand ?
|> Is it just a question of whether and how __iadd__ is implemented,
|> or is there some deeper meaning in this ?
|> Is it a bug ?  
| There's a deeper meaning ;-)
| Lookup "mutable" types.
| Hint: a list is "mutable", a string and an integer are not.

The way I see it, he's right on target with ``whether and how __iadd__
is implemented''  It's true that you can't expect to see immutable
objects modified, a contradiction in terms, but you certainly can
implement a mutable object that reassigns to the left hand side.
So mutability isn't the real issue (as usual.)

	Donn Cave, donn at

More information about the Python-list mailing list