diff options
author | Miss Skeleton (bot) <31488909+miss-islington@users.noreply.github.com> | 2020-10-05 17:05:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-10-05 17:05:50 (GMT) |
commit | 4aad1e5770fab72908f922a7876075d3d5a7c0d0 (patch) | |
tree | 19b087588f40db489100423ddc05fa7af37f0603 /Doc/reference | |
parent | 10b4136bfa5878c058753e1d1bd091e0f7e1ba40 (diff) | |
download | cpython-4aad1e5770fab72908f922a7876075d3d5a7c0d0.zip cpython-4aad1e5770fab72908f922a7876075d3d5a7c0d0.tar.gz cpython-4aad1e5770fab72908f922a7876075d3d5a7c0d0.tar.bz2 |
bpo-41584: clarify when the reflected method of a binary arithemtic operator is called (GH-22505)
(cherry picked from commit d02d824e05e2cb86f4df381be18832e76e2c475f)
Co-authored-by: Brett Cannon <brett@python.org>
Diffstat (limited to 'Doc/reference')
-rw-r--r-- | Doc/reference/datamodel.rst | 15 |
1 files changed, 8 insertions, 7 deletions
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index fc304a1..354c6ce 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -2376,10 +2376,11 @@ left undefined. .. note:: - 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. This behavior allows - subclasses to override their ancestors' operations. + If the right operand's type is a subclass of the left operand's type and + that subclass provides a different implementation of the reflected method + for the operation, this method will be called before the left operand's + non-reflected method. This behavior allows subclasses to override their + ancestors' operations. .. method:: object.__iadd__(self, other) @@ -2778,6 +2779,6 @@ An example of an asynchronous context manager class:: method—that will instead have the opposite effect of explicitly *blocking* such fallback. -.. [#] For operands of the same type, it is assumed that if the non-reflected method - (such as :meth:`__add__`) fails the operation is not supported, which is why the - reflected method is not called. +.. [#] For operands of the same type, it is assumed that if the non-reflected + method -- such as :meth:`__add__` -- fails then the overall operation is not + supported, which is why the reflected method is not called. |