https://github.com/python/cpython/commit/9eb7ed71214dbfbeea0a3785db5a45dc89788fb4
commit: 9eb7ed71214dbfbeea0a3785db5a45dc89788fb4
branch: 3.11
author: Miss Islington (bot) <[email protected]>
committer: erlend-aasland <[email protected]>
date: 2024-03-01T16:09:02Z
summary:

[3.11] gh-104219: Document that idunders can return NotImplemented (GH-104220) 
(#116211)

(cherry picked from commit 2713c2abc8d0f30cd0060cd307bb4ec92f1f04bf)

Co-authored-by: Gouvernathor <[email protected]>
Co-authored-by: C.A.M. Gerlach <[email protected]>
Co-authored-by: Jelle Zijlstra <[email protected]>

files:
M Doc/reference/datamodel.rst

diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst
index 5a1777e7b92f3e..c1f4230c3dbcbb 100644
--- a/Doc/reference/datamodel.rst
+++ b/Doc/reference/datamodel.rst
@@ -3016,10 +3016,12 @@ left undefined.
    (``+=``, ``-=``, ``*=``, ``@=``, ``/=``, ``//=``, ``%=``, ``**=``, ``<<=``,
    ``>>=``, ``&=``, ``^=``, ``|=``).  These methods should attempt to do the
    operation in-place (modifying *self*) and return the result (which could be,
-   but does not have to be, *self*).  If a specific method is not defined, the
+   but does not have to be, *self*).  If a specific method is not defined, or 
if
+   that method returns :data:`NotImplemented`, the
    augmented assignment falls back to the normal methods.  For instance, if *x*
    is an instance of a class with an :meth:`__iadd__` method, ``x += y`` is
-   equivalent to ``x = x.__iadd__(y)`` . Otherwise, ``x.__add__(y)`` and
+   equivalent to ``x = x.__iadd__(y)`` . If :meth:`__iadd__` does not exist, 
or if ``x.__iadd__(y)``
+   returns :data:`!NotImplemented`, ``x.__add__(y)`` and
    ``y.__radd__(x)`` are considered, as with the evaluation of ``x + y``. In
    certain situations, augmented assignment can result in unexpected errors 
(see
    :ref:`faq-augmented-assignment-tuple-error`), but this behavior is in fact

_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]

Reply via email to