Skip to content

gh-144837: Improve documentation for more collection methods#144841

Merged
serhiy-storchaka merged 4 commits intopython:mainfrom
serhiy-storchaka:docs-collections-signatures
Mar 26, 2026
Merged

gh-144837: Improve documentation for more collection methods#144841
serhiy-storchaka merged 4 commits intopython:mainfrom
serhiy-storchaka:docs-collections-signatures

Conversation

@serhiy-storchaka
Copy link
Member

@serhiy-storchaka serhiy-storchaka commented Feb 15, 2026

Use uniform standard signature syntax in the tutorial and in the array and collections modules documentation.


📚 Documentation preview 📚: https://cpython-previews--144841.org.readthedocs.build/

Use uniform standard signature syntax in the tutorial and in
the array and collections modules documentation.
.. method:: append(value, /)

Append a new item with value *x* to the end of the array.
Append a new item with the specified value to the end of the array.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Append a new item with the specified value to the end of the array.
Append a new item with the specified *value* to the end of the array.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure about this. I tried to avoid value *value*.

Copy link
Member

@nedbat nedbat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a few tweaks.



.. method:: list.index(x[, start[, end]])
.. method:: list.index(value[, start[, stop])
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This still has square brackets? Also, they are unbalanced.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I copied it from other place which already had such error.

As for the signature of the index() methods, this is a different issue. First, we need to decide if it needs to support None (see #138134), or this is just an unintentional implementation artifact. If yes, then we can write

list.index(value, start=None, stop=None, /)

If not, then we need to write

list.index(value, start=0, stop=sys.maxsize, /)

or use multiple signatures:

list.index(value, start=0, /)
list.index(value, start, stop, /)

This is a separate large issue.

@bedevere-app
Copy link

bedevere-app bot commented Feb 19, 2026

When you're done making the requested changes, leave the comment: I have made the requested changes; please review again.

Co-authored-by: Ned Batchelder <ned@nedbatchelder.com>
Copy link
Member Author

@serhiy-storchaka serhiy-storchaka left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have made the requested changes; please review again.



.. method:: list.index(x[, start[, end]])
.. method:: list.index(value[, start[, stop])
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch! I copied it from other place which already had such error.

As for the signature of the index() methods, this is a different issue. First, we need to decide if it needs to support None (see #138134), or this is just an unintentional implementation artifact. If yes, then we can write

list.index(value, start=None, stop=None, /)

If not, then we need to write

list.index(value, start=0, stop=sys.maxsize, /)

or use multiple signatures:

list.index(value, start=0, /)
list.index(value, start, stop, /)

This is a separate large issue.

@serhiy-storchaka serhiy-storchaka force-pushed the docs-collections-signatures branch from 7ac12f6 to e0fe9c7 Compare February 20, 2026 09:11
@serhiy-storchaka
Copy link
Member Author

I'll merge this, and then, as we discussed at https://discuss.python.org/t/a-small-typo-on-5-1-more-on-lists-section/106150, we will try to improve the section in the tutorial.

@serhiy-storchaka serhiy-storchaka merged commit 17070f4 into python:main Mar 26, 2026
52 of 53 checks passed
@github-project-automation github-project-automation bot moved this from Todo to Done in Docs PRs Mar 26, 2026
@miss-islington-app
Copy link

Thanks @serhiy-storchaka for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13, 3.14.
🐍🍒⛏🤖

@serhiy-storchaka serhiy-storchaka deleted the docs-collections-signatures branch March 26, 2026 19:29
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 26, 2026
…ythonGH-144841)

Use uniform standard signature syntax in the tutorial and in
the array and collections modules documentation.
(cherry picked from commit 17070f41d4ccf5e82e5841e467b3aef5294f2c9a)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request Mar 26, 2026
…ythonGH-144841)

Use uniform standard signature syntax in the tutorial and in
the array and collections modules documentation.
(cherry picked from commit 17070f4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
@bedevere-app
Copy link

bedevere-app bot commented Mar 26, 2026

GH-146483 is a backport of this pull request to the 3.14 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.14 bugs and security fixes label Mar 26, 2026
@bedevere-app
Copy link

bedevere-app bot commented Mar 26, 2026

GH-146484 is a backport of this pull request to the 3.13 branch.

@bedevere-app bedevere-app bot removed the needs backport to 3.13 bugs and security fixes label Mar 26, 2026
serhiy-storchaka added a commit that referenced this pull request Mar 26, 2026
…H-144841) (GH-146484)

Use uniform standard signature syntax in the tutorial and in
the array and collections modules documentation.
(cherry picked from commit 17070f4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
serhiy-storchaka added a commit that referenced this pull request Mar 26, 2026
…H-144841) (GH-146483)

Use uniform standard signature syntax in the tutorial and in
the array and collections modules documentation.
(cherry picked from commit 17070f4)

Co-authored-by: Serhiy Storchaka <storchaka@gmail.com>
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 skip news

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants