Message376944
Qualifying that the right operand's type must be a *strict* subclass for the reflected method to take precedence avoids an edge case / counter-example when the types are actually equal.
>>> class A:
... def __add__(self, other):
... print(1)
... def __radd__(self, other):
... print(2)
...
>>> A() + A()
1
>>> issubclass(A, A)
True |
|
Date |
User |
Action |
Args |
2020-09-15 15:59:08 | wim.glenn | set | recipients:
+ wim.glenn, docs@python |
2020-09-15 15:59:08 | wim.glenn | set | messageid: <1600185548.76.0.619464921638.issue41793@roundup.psfhosted.org> |
2020-09-15 15:59:08 | wim.glenn | link | issue41793 messages |
2020-09-15 15:59:08 | wim.glenn | create | |
|