inconsistency with += between different types ?

Jonathan Hogg jonathan at
Mon Aug 5 18:41:11 CEST 2002

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.


More information about the Python-list mailing list