You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am referring to http://pymbook.readthedocs.io/en/latest/operatorsexpressions.html#shorthand-operator. x op= y is not always equivalent to x = x op y. The statement is always true for immutable objects like ints and tuples. Mutable objects, on the other hand, can have a completely different implementation of the shorthand operators since those operators can modify the object in-place. For example, lists define a legitimately different __iadd__ operator (which is basically extend).
The text was updated successfully, but these errors were encountered:
I am referring to http://pymbook.readthedocs.io/en/latest/operatorsexpressions.html#shorthand-operator. x op= y is not always equivalent to x = x op y. The statement is always true for immutable objects like ints and tuples. Mutable objects, on the other hand, can have a completely different implementation of the shorthand operators since those operators can modify the object in-place. For example, lists define a legitimately different
__iadd__
operator (which is basicallyextend
).The text was updated successfully, but these errors were encountered: