Message230405
https://docs.python.org/2/reference/datamodel.html#object.__iadd__
------------------------------------------------------------------
[...] These methods should attempt to do the operation in-place (modifying self) and return the result (which could be, but does not have to be, self). If a specific method is not defined, the augmented assignment falls back to the normal methods. 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.
-------------------------------------------------------------------
Returning NotImplemented still allows a TypeError to be raised, is subclass friendly, and is the way Python is designed. |
|
Date |
User |
Action |
Args |
2014-10-31 22:31:21 | ethan.furman | set | recipients:
+ ethan.furman, rhettinger, pitrou, r.david.murray, Joshua.Chin |
2014-10-31 22:31:20 | ethan.furman | set | messageid: <1414794680.98.0.595971074307.issue22766@psf.upfronthosting.co.za> |
2014-10-31 22:31:20 | ethan.furman | link | issue22766 messages |
2014-10-31 22:31:20 | ethan.furman | create | |
|