Tuples and immutability
Marko Rauhamaa
marko at pacujo.net
Sun Mar 9 05:35:31 EDT 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.
Marko
More information about the Python-list
mailing list