From: Ethan Furman Date: Thu, 27 Nov 2014 05:17:53 +0000 (-0800) Subject: Issue22780: reword NotImplemented docs to emphasise should X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=9b55089999bfb12b0c8f6e9ccd91f712831f31dc;p=python Issue22780: reword NotImplemented docs to emphasise should --- 9b55089999bfb12b0c8f6e9ccd91f712831f31dc diff --cc Doc/library/constants.rst index a625b43442,42b5af23a5..d5a0f09173 --- a/Doc/library/constants.rst +++ b/Doc/library/constants.rst @@@ -26,11 -26,26 +26,25 @@@ A small number of constants live in th .. 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 The same as ``...``. Special value used mostly in conjunction with extended