Documentation
In the documentation, in the description of __iadd__() and other similar methods implementing the augmented arithmetic assignments (+=, -=, *=, /=, //=, %=, **=, <<=, >>=, &=, ^=, |=), the following contradiction (as it seems to me) occurs:
- "These methods should attempt to do the operation in-place (modifying self)"
- "For instance, if x is an instance of a class with an
__iadd__() method, x += y is equivalent to x = x.__iadd__(y)"
As far as I understand, if __iadd__() method attempts to do the operation "in-place (modifying self)", then “x =” at the beginning of this statement:
x = x.__iadd__(y)
… is redundant.
Documentation
In the documentation, in the description of
__iadd__()and other similar methods implementing the augmented arithmetic assignments (+=, -=, *=, /=, //=, %=, **=, <<=, >>=, &=, ^=, |=), the following contradiction (as it seems to me) occurs:__iadd__()method,x += yis equivalent tox = x.__iadd__(y)"As far as I understand, if
__iadd__()method attempts to do the operation "in-place (modifying self)", then “x =” at the beginning of this statement:x = x.__iadd__(y)… is redundant.