8000 Add IndexError to tutorial datastructures list.pop doc · Issue #114648 · python/cpython · GitHub
[go: up one dir, main page]

Skip to content

Add IndexError to tutorial datastructures list.pop doc #114648

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
ShivnarenSrinivasan opened this issue Jan 27, 2024 · 4 comments
Closed

Add IndexError to tutorial datastructures list.pop doc #114648

ShivnarenSrinivasan opened this issue Jan 27, 2024 · 4 comments
Labels
docs Documentation in the Doc dir easy

Comments

@ShivnarenSrinivasan
Copy link
Contributor
ShivnarenSrinivasan commented Jan 27, 2024

Documentation

In the Datastructures tutorial, the remove and index methods mention that an IndexError may be raised.
The tutorial is not intended to be an extensive reference, but I feel it is better to state the potential exception.

We could add the boldfaced text to the paragraph:

list.pop([i])
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 IndexError if the list 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.)

Thoughts?

Linked PRs

@ShivnarenSrinivasan ShivnarenSrinivasan added the docs Documentation in the Doc dir label Jan 27, 2024
@serhiy-storchaka
Copy link
Member

Looks reasonable. Do you mind to create a PR?

@ShivnarenSrinivasan
Copy link
Contributor Author
ShivnarenSrinivasan commented Jan 28, 2024

Will do

@ShivnarenSrinivasan
Copy link
Contributor Author

take

@terryjreedy terryjreedy changed the title Update list.pop doc in datastructures tutorial to include the IndexError Add IndexError to tutorial datastructures list.pop doc Feb 1, 2024
terryjreedy pushed a commit that referenced this issue Feb 1, 2024
…op entry (#114681)

Remove redundant explanation of optional argument.
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Feb 1, 2024
…list.pop entry (pythonGH-114681)

Remove redundant explanation of optional argument.
(cherry picked from commit 57c3e77)

Co-authored-by: srinivasan <shivnaren@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue Feb 1, 2024
…list.pop entry (pythonGH-114681)

Remove redundant explanation of optional argument.
(cherry picked from commit 57c3e77)

Co-authored-by: srinivasan <shivnaren@gmail.com>
terryjreedy pushed a commit that referenced this issue Feb 1, 2024
… list.pop entry (GH-114681) (#114841)

Remove redundant explanation of optional argument.
(cherry picked from commit 57c3e77)

Co-authored-by: srinivasan <shivnaren@gmail.com>
terryjreedy pushed a commit that referenced this issue Feb 1, 2024
… list.pop entry (GH-114681) (#114842)

Remove redundant explanation of optional argument.
(cherry picked from commit 57c3e77)

Co-authored-by: srinivasan <shivnaren@gmail.com>
@terryjreedy
Copy link
Member

Thank you for the report and PR. This exception is part of list.pop's API.

aisk pushed a commit to aisk/cpython that referenced this issue Feb 11, 2024
…list.pop entry (python#114681)

Remove redundant explanation of optional argument.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir easy
Projects
None yet
Development

No branches or pull requests

3 participants
0