]> granicus.if.org Git - python/commitdiff
Issue22780: reword NotImplemented docs to emphasise should
authorEthan Furman <ethan@stoneleaf.us>
Thu, 27 Nov 2014 05:17:53 +0000 (21:17 -0800)
committerEthan Furman <ethan@stoneleaf.us>
Thu, 27 Nov 2014 05:17:53 +0000 (21:17 -0800)
1  2 
Doc/library/constants.rst
Doc/reference/datamodel.rst

index a625b43442687c178e25381aadcc804a6083534c,42b5af23a5b9f2a81b3bb22940f8ceddfae5bbe5..d5a0f09173b3b7f91f8f621319f324ec4fdf5111
@@@ -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
Simple merge