Skip to content

Commit d02d824

Browse files
authored
bpo-41584: clarify when the reflected method of a binary arithemtic operator is called (python#22505)
1 parent 1fce240 commit d02d824

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

Doc/reference/datamodel.rst

+8-7
Original file line numberDiff line numberDiff line change
@@ -2376,10 +2376,11 @@ left undefined.
23762376

23772377
.. note::
23782378

2379-
If the right operand's type is a subclass of the left operand's type and that
2380-
subclass provides the reflected method for the operation, this method will be
2381-
called before the left operand's non-reflected method. This behavior allows
2382-
subclasses to override their ancestors' operations.
2379+
If the right operand's type is a subclass of the left operand's type and
2380+
that subclass provides a different implementation of the reflected method
2381+
for the operation, this method will be called before the left operand's
2382+
non-reflected method. This behavior allows subclasses to override their
2383+
ancestors' operations.
23832384

23842385

23852386
.. method:: object.__iadd__(self, other)
@@ -2771,6 +2772,6 @@ An example of an asynchronous context manager class::
27712772
method—that will instead have the opposite effect of explicitly
27722773
*blocking* such fallback.
27732774
2774-
.. [#] For operands of the same type, it is assumed that if the non-reflected method
2775-
(such as :meth:`__add__`) fails the operation is not supported, which is why the
2776-
reflected method is not called.
2775+
.. [#] For operands of the same type, it is assumed that if the non-reflected
2776+
method -- such as :meth:`__add__` -- fails then the overall operation is not
2777+
supported, which is why the reflected method is not called.

0 commit comments

Comments
 (0)