27 ms·
> because it parses the same Does not. One is addition, the other is in-place addition; they're different things and can behave differently. E.g. in "a += b" a
by blattimwind 8y ago
> because it parses the same
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.
- ben-schaaf 8y agoTo 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.