[Python-checkins] bpo-41584: clarify when the reflected method of a binary arithemtic operator is called (GH-22505)
Miss Skeleton (bot)
webhook-mailer at python.org
Mon Oct 5 12:52:11 EDT 2020
https://github.com/python/cpython/commit/31ceccb2c77854893f3a754aca04bedd74bedb10
commit: 31ceccb2c77854893f3a754aca04bedd74bedb10
branch: 3.8
author: Miss Skeleton (bot) <31488909+miss-islington at users.noreply.github.com>
committer: GitHub <noreply at github.com>
date: 2020-10-05T09:52:02-07:00
summary:
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 at python.org>
files:
M Doc/reference/datamodel.rst
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index 3f05385862416..924f6d9e2d7e0 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -2371,10 +2371,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)
@@ -2773,6 +2774,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.
More information about the Python-checkins
mailing list