inconsistency with += between different types ?

Jonathan Hogg jonathan at onegoodidea.com
Mon Aug 5 12:41:11 EDT 2002


On 5/8/2002 17:10, in article
slrnakt9pu.c05.Andreas.Leitgeb at pc7499.gud.siemens.at, "Andreas Leitgeb"
<Andreas.Leitgeb at siemens.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.

Jonathan




More information about the Python-list mailing list