]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-114648: Add IndexError exception to tutorial datastructures list.pop entry (#114681)
authorsrinivasan <shivnaren@gmail.com>
Thu, 1 Feb 2024 03:46:49 +0000 (09:16 +0530)
committerGitHub <noreply@github.com>
Thu, 1 Feb 2024 03:46:49 +0000 (22:46 -0500)
Remove redundant explanation of optional argument.

Doc/tutorial/datastructures.rst

index 87614d082a1d4e0b76483577027fe747918b1e61..de2827461e2f241cedd5f2ecb8a9e3499a82a4fc 100644 (file)
@@ -48,10 +48,9 @@ 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.
 
 
 .. method:: list.clear()