From 8ce0079b5a7ea414d410c690abe2e4ead52f4f07 Mon Sep 17 00:00:00 2001 From: Mike Castle Date: Sat, 1 Feb 2025 16:43:31 -0800 Subject: [PATCH 1/2] Move link supression around in a Note for exceptions.rst (#129015) This makes it similar to the same text in constants.rst. --- Doc/library/exceptions.rst | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst index f72b11e34c5c3d..3358d6e41cbab0 100644 --- a/Doc/library/exceptions.rst +++ b/Doc/library/exceptions.rst @@ -335,9 +335,9 @@ The following exceptions are the exceptions that are usually raised. .. note:: - ``NotImplementedError`` and :data:`NotImplemented` are not interchangeable, + ``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. + :data:`NotImplemented` for details on when to use it. .. exception:: OSError([arg]) OSError(errno, strerror[, filename[, winerror[, filename2]]]) From d8546e1a1f539723a6896acb0c433ed204dc2471 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?B=C3=A9n=C3=A9dikt=20Tran?= <10796600+picnixz@users.noreply.github.com> Date: Mon, 17 Feb 2025 11:33:57 +0100 Subject: [PATCH 2/2] apply Adam's suggestion --- Doc/library/constants.rst | 9 +++++---- Doc/library/exceptions.rst | 10 ++++++---- 2 files changed, 11 insertions(+), 8 deletions(-) diff --git a/Doc/library/constants.rst b/Doc/library/constants.rst index 04bb8c51a3b197..c0ac4ea8412ebd 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 was deprecated. diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst index 681d9c118e3412..c56604339030d3 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]]])