Re:PEP 572: Python assignment expressions has been accepted
by ben-schaaf on Tuesday July 03, 2018 @10:45AM
(#17450607)
To be more specific for python:
"a += b" -> "a = a.__iadd__(b)"
"a = a + b" -> "a = a.__add__(b)"
"__iadd__" and "__add__" can do whatever they want.
Does not. One is addition, the other is in-place addition; they're different things and can behave differently. E.g. in "a += b" and "a = a + b", the former might not construct an intermediate object, but mutate the existing a.