From bc03f58efcd4dac18dba2eb697a8bf01f2c26234 Mon Sep 17 00:00:00 2001 From: srinivasan Date: Sun, 28 Jan 2024 15:02:34 +0000 Subject: [PATCH 1/3] Added IndexError exception to tutorial. To be consistent with the other two `list` methods (`remove` and `insert`) which have documented exceptions. --- Doc/tutorial/datastructures.rst | 10 ++++++---- .../2024-01-28-14-31-53.gh-issue-114648.LkD8IM.rst | 1 + 2 files changed, 7 insertions(+), 4 deletions(-) create mode 100644 Misc/NEWS.d/next/Documentation/2024-01-28-14-31-53.gh-issue-114648.LkD8IM.rst diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst index 87614d082a1d4e..6083c89a4902aa 100644 --- a/Doc/tutorial/datastructures.rst +++ b/Doc/tutorial/datastructures.rst @@ -48,10 +48,12 @@ objects: :noindex: Remove the item at the given position in the list, and return it. If no index - is specified, ``a.pop()`` removes and returns the last item in the list. (The - square brackets around the *i* in the method signature denote that the parameter - is optional, not that you should type square brackets at that position. You - will see this notation frequently in the Python Library Reference.) + is specified, ``a.pop()`` removes and returns the last item in the list. + It raises an :exc:`IndexError` if the list is empty or the index is + outside the list range. (The square brackets around the *i* in the method + signature denote that the parameter is optional, not that you should type + square brackets at that position. You will see this notation frequently in + the Python Library Reference.) .. method:: list.clear() diff --git a/Misc/NEWS.d/next/Documentation/2024-01-28-14-31-53.gh-issue-114648.LkD8IM.rst b/Misc/NEWS.d/next/Documentation/2024-01-28-14-31-53.gh-issue-114648.LkD8IM.rst new file mode 100644 index 00000000000000..d90a0869833be2 --- /dev/null +++ b/Misc/NEWS.d/next/Documentation/2024-01-28-14-31-53.gh-issue-114648.LkD8IM.rst @@ -0,0 +1 @@ +Added :exc:`IndexError` to :meth:`pop` of :class:`list`. From 79fe28579e5388983dabfd4f38f87734c57688f0 Mon Sep 17 00:00:00 2001 From: srinivasan Date: Sun, 28 Jan 2024 17:23:11 +0000 Subject: [PATCH 2/3] Removed unnecessary NEWS entry --- .../Documentation/2024-01-28-14-31-53.gh-issue-114648.LkD8IM.rst | 1 - 1 file changed, 1 deletion(-) delete mode 100644 Misc/NEWS.d/next/Documentation/2024-01-28-14-31-53.gh-issue-114648.LkD8IM.rst diff --git a/Misc/NEWS.d/next/Documentation/2024-01-28-14-31-53.gh-issue-114648.LkD8IM.rst b/Misc/NEWS.d/next/Documentation/2024-01-28-14-31-53.gh-issue-114648.LkD8IM.rst deleted file mode 100644 index d90a0869833be2..00000000000000 --- a/Misc/NEWS.d/next/Documentation/2024-01-28-14-31-53.gh-issue-114648.LkD8IM.rst +++ /dev/null @@ -1 +0,0 @@ -Added :exc:`IndexError` to :meth:`pop` of :class:`list`. From 478889da36132154d3252beca061882881c125fb Mon Sep 17 00:00:00 2001 From: srinivasan Date: Mon, 29 Jan 2024 12:24:03 +0000 Subject: [PATCH 3/3] Removed redundant explanation of optional argument --- Doc/tutorial/datastructures.rst | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/Doc/tutorial/datastructures.rst b/Doc/tutorial/datastructures.rst index 6083c89a4902aa..de2827461e2f24 100644 --- a/Doc/tutorial/datastructures.rst +++ b/Doc/tutorial/datastructures.rst @@ -50,10 +50,7 @@ objects: Remove the item at the given position in the list, and return it. If no index is specified, ``a.pop()`` removes and returns the last item in the list. It raises an :exc:`IndexError` if the list is empty or the index is - outside the list range. (The square brackets around the *i* in the method - signature denote that the parameter is optional, not that you should type - square brackets at that position. You will see this notation frequently in - the Python Library Reference.) + outside the list range. .. method:: list.clear()