Title: Inaccuracy about reflected operands in datamodel docs.
Type: Stage: patch review
Components: Documentation Versions:
Status: open Resolution:
Dependencies: Superseder:
Assigned To: docs@python Nosy List: docs@python, wim.glenn
Priority: normal Keywords: patch

Created on 2020-09-15 15:59 by wim.glenn, last changed 2020-09-15 16:02 by wim.glenn.

Pull Requests
URL Status Linked Edit
PR 22257 open wim.glenn, 2020-09-15 16:02
Messages (1)
msg376944 - (view) Author: wim glenn (wim.glenn) * Date: 2020-09-15 15:59
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()
    >>> issubclass(A, A)
Date User Action Args
2020-09-15 16:02:51wim.glennsetkeywords: + patch
stage: patch review
pull_requests: + pull_request21312
2020-09-15 15:59:08wim.glenncreate