summaryrefslogtreecommitdiffstats
path: root/Doc/library/constants.rst
diff options
context:
space:
mode:
authorEthan Furman <ethan@stoneleaf.us>2014-11-27 05:17:53 (GMT)
committerEthan Furman <ethan@stoneleaf.us>2014-11-27 05:17:53 (GMT)
commit9b55089999bfb12b0c8f6e9ccd91f712831f31dc (patch)
treef5c0e709a3e438c2af35883f9cf75649f1595142 /Doc/library/constants.rst
parent0a59d5563ecb632a61d8e45761824c76bfacbeea (diff)
parentb004943e9bca2f938b313172367a271f69aa29a5 (diff)
downloadcpython-9b55089999bfb12b0c8f6e9ccd91f712831f31dc.zip
cpython-9b55089999bfb12b0c8f6e9ccd91f712831f31dc.tar.gz
cpython-9b55089999bfb12b0c8f6e9ccd91f712831f31dc.tar.bz2
Issue22780: reword NotImplemented docs to emphasise should
Diffstat (limited to 'Doc/library/constants.rst')
-rw-r--r--Doc/library/constants.rst20
1 files changed, 17 insertions, 3 deletions
diff --git a/Doc/library/constants.rst b/Doc/library/constants.rst
index a625b43..d5a0f09 100644
--- a/Doc/library/constants.rst
+++ b/Doc/library/constants.rst
@@ -26,9 +26,23 @@ A small number of constants live in the built-in namespace. They are:
.. data:: NotImplemented
- Special value which should be returned by the special methods
- (:meth:`__eq__`, :meth:`__lt__`, :meth:`__add__`, etc.) to indicate
- that the operation is not implemented with respect to the other type.
+ Special value which should be returned by the binary special methods
+ (e.g. :meth:`__eq__`, :meth:`__lt__`, :meth:`__add__`, :meth:`__rsub__`,
+ etc.) to indicate that the operation is not implemented with respect to
+ the other type; may be returned by the in-place binary special methods
+ (e.g. :meth:`__imul__`, :meth:`__iand__`, etc.) for the same purpose.
+ Its truth value is true.
+
+.. note::
+
+ When ``NotImplemented`` is returned, the interpreter will then try the
+ reflected operation on the other type, or some other fallback, depending
+ on the operator. If all attempted operations return ``NotImplemented``, the
+ interpreter will raise an appropriate exception.
+
+ See
+ :ref:`implementing-the-arithmetic-operations`
+ for more details.
.. data:: Ellipsis