Tuples and immutability
marko at pacujo.net
Sun Mar 9 10:35:31 CET 2014
Ian Kelly <ian.g.kelly at gmail.com>:
> In my view the second one is wrong. a += b should be understood as
> being equivalent to a = a + b, but with the *possible* and by no means
> guaranteed optimization that the operation may be performed in-place.
Some call it an optimization, others call it a side effect.
Anyway, that's how it has been explicitly defined in the language
specification so that's the reality whether one likes it or not.
More information about the Python-list