[New-bugs-announce] [issue41584] Clarify documentation for binary arithmetic operation subclass __r*__ precedence
Brett Cannon
report at bugs.python.org
Tue Aug 18 13:56:34 EDT 2020
New submission from Brett Cannon <brett at python.org>:
https://docs.python.org/3/reference/datamodel.html#object.__ror__ has a note saying:
"If the right operand's type is a subclass of the left operand's type and that subclass provides the reflected method for the operation, this method will be called before the left operand's non-reflected method." The slightly unclear part (at least to me) is the "provides the reflected method."
What this actually means according to https://bugs.python.org/issue30140 is that the subclass **implements** the `__r*__` method, not just that the method is reachable on the subclass via getattr(). That wasn't clear to me when I initially read this.
----------
assignee: docs at python
components: Documentation
messages: 375621
nosy: brett.cannon, docs at python
priority: normal
severity: normal
stage: needs patch
status: open
title: Clarify documentation for binary arithmetic operation subclass __r*__ precedence
versions: Python 3.10, Python 3.8, Python 3.9
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue41584>
_______________________________________
More information about the New-bugs-announce
mailing list