[New-bugs-announce] [issue41793] Inaccuracy about reflected operands in datamodel docs.

wim glenn report at bugs.python.org
Tue Sep 15 11:59:08 EDT 2020


New submission from wim glenn <wim.glenn at gmail.com>:

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

----------
assignee: docs at python
components: Documentation
messages: 376944
nosy: docs at python, wim.glenn
priority: normal
severity: normal
status: open
title: Inaccuracy about reflected operands in datamodel docs.

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41793>
_______________________________________


More information about the New-bugs-announce mailing list