aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrett Cannon <brett@python.org>2020-10-05 09:42:21 -0700
committerGitHub <noreply@github.com>2020-10-05 09:42:21 -0700
commitd02d824e05e2cb86f4df381be18832e76e2c475f (patch)
treedc7b493f54bb1faf06ab310c592ba51a032d2757 /Doc/reference
parentbpo-41939: Fix test_site.test_license_exists_at_url() (#22559) (diff)
downloadcpython-d02d824e05e2cb86f4df381be18832e76e2c475f.tar.gz
cpython-d02d824e05e2cb86f4df381be18832e76e2c475f.tar.bz2
cpython-d02d824e05e2cb86f4df381be18832e76e2c475f.zip
bpo-41584: clarify when the reflected method of a binary arithemtic operator is called (#22505)
Diffstat (limited to 'Doc/reference')
-rw-r--r--Doc/reference/datamodel.rst15
1 files changed, 8 insertions, 7 deletions
diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index a817408c3b1..4396f1b9b72 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)
@@ -2771,6 +2772,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.