https://github.com/python/cpython/commit/43635f2f52cb569b05fdd2f80ba5ed0e2408df24
commit: 43635f2f52cb569b05fdd2f80ba5ed0e2408df24
branch: 3.12
author: Miss Islington (bot) <31488909+miss-isling...@users.noreply.github.com>
committer: picnixz <10796600+picn...@users.noreply.github.com>
date: 2025-03-03T08:31:08Z
summary:

[3.12] gh-129015: Improve disambiguation between `NotImplemented` and 
`NotImplementedError` (GH-129562) (#130777)

gh-129015: Improve disambiguation between `NotImplemented` and 
`NotImplementedError` (GH-129562)

---------

(cherry picked from commit a85eeb97710617404ba7a0fac3b264f586caf70c)

Co-authored-by: Mike Castle <dalgoda+git...@gmail.com>
Co-authored-by: Bénédikt Tran <10796600+picn...@users.noreply.github.com>
Co-authored-by: Adam Turner <9087854+aa-tur...@users.noreply.github.com>

files:
M Doc/library/constants.rst
M Doc/library/exceptions.rst

diff --git a/Doc/library/constants.rst b/Doc/library/constants.rst
index 3eceecc4e0a736..383bc272116f7a 100644
--- a/Doc/library/constants.rst
+++ b/Doc/library/constants.rst
@@ -46,11 +46,12 @@ A small number of constants live in the built-in namespace. 
 They are:
 
       See :ref:`implementing-the-arithmetic-operations` for examples.
 
-   .. note::
+   .. caution::
 
-      ``NotImplementedError`` and :data:`!NotImplemented` are not 
interchangeable,
-      even though they have similar names and purposes.
-      See :exc:`NotImplementedError` for details on when to use it.
+      :data:`!NotImplemented` and :exc:`!NotImplementedError` are not
+      interchangeable. This constant should only be used as described
+      above; see :exc:`NotImplementedError` for details on correct usage
+      of the exception.
 
    .. versionchanged:: 3.9
       Evaluating :data:`!NotImplemented` in a boolean context is deprecated. 
While
diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst
index 7e0c0f05bb7156..f168ab2cce7faf 100644
--- a/Doc/library/exceptions.rst
+++ b/Doc/library/exceptions.rst
@@ -333,11 +333,13 @@ The following exceptions are the exceptions that are 
usually raised.
       meant to be supported at all -- in that case either leave the operator /
       method undefined or, if a subclass, set it to :data:`None`.
 
-   .. note::
+   .. caution::
+
+      :exc:`!NotImplementedError` and :data:`!NotImplemented` are not
+      interchangeable. This exception should only be used as described
+      above; see :data:`NotImplemented` for details on correct usage of
+      the built-in constant.
 
-      ``NotImplementedError`` and :data:`NotImplemented` are not 
interchangeable,
-      even though they have similar names and purposes.  See
-      :data:`!NotImplemented` for details on when to use it.
 
 .. exception:: OSError([arg])
                OSError(errno, strerror[, filename[, winerror[, filename2]]])

_______________________________________________
Python-checkins mailing list -- python-checkins@python.org
To unsubscribe send an email to python-checkins-le...@python.org
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: arch...@mail-archive.com

Reply via email to