__iadd__
mutates the list, whereas __add__
returns a new list, as demonstrated.
An expression of x += y
first tries to call __iadd__
and, failing that, calls __add__
followed an assignment (see Sven’s comment for a minor correction). Since list
has __iadd__
then it does this little bit ‘o mutation magic.