inconsistency with += between different types ?

Christopher A. Craig list-python at
Wed Aug 7 18:52:18 CEST 2002

"Donn Cave" <donn at> writes:

> The sad thing is, all this hand-waving is really germane to only one
> issue I can think of, an object's suitability for use as a hash key.

It is also relevant to a lot of things related to numbers.  All
references to the same integer reference the same object.  This means
that if integers were mutable then in theory the following result
could occur (a result, which I'll note is similar to something that
was actually possible in early versions of SmallTalk for reasons of

>>> a=t=5
>>> t+=2
>>> t
>>> a
>>> 5

Christopher A. Craig <list-python at>
Linux: (n) "A microkernel on which one can run operating system kernels
such as XEmacs."  -- Froggie, from Everything

More information about the Python-list mailing list