Message206163
The current doc is correct. Unlike the old incorrect version of the operator doc (#7259), it does not say that the call is all of the execution. The suggested replacement "x = x.__iadd__(y) is called" is not correct as statements are not called.
The said, it seems that some people miss the fact that augmented assignment always does an assignment. So, considering that the first sentence of the paragraph, "These methods are called to implement the augmented arithmetic assignments (+=, -=, *=, /=, //=, %=, **=, <<=, >>=, &=, ^=, |=)." already talks about calling, I thing
"For instance, to execute the statement x += y, where x is an instance of a class that has an __iadd__() method, x.__iadd__(y) is called. If x is an instance of a class that does not define a __iadd__() method, x.__add__(y) and y.__radd__(x) are considered, as with the evaluation of x + y."
might be replaced by
"For instance, if x is an instance of a class with an __iadd__() method, x += y is equivalent to x = x.__iadd__(y) . Otherwise, x.__add__(y) and y.__radd__(x) are considered, as with the evaluation of x + y." |
|
Date |
User |
Action |
Args |
2013-12-14 02:55:31 | terry.reedy | set | recipients:
+ terry.reedy, docs@python, ferno |
2013-12-14 02:55:31 | terry.reedy | set | messageid: <1386989731.39.0.597709518015.issue19953@psf.upfronthosting.co.za> |
2013-12-14 02:55:31 | terry.reedy | link | issue19953 messages |
2013-12-14 02:55:30 | terry.reedy | create | |
|