Skip to content

Update signatures of builtins in the documentation #137609

Description

@serhiy-storchaka

The following PR updates signatures for all functions and classes in the builtins module. They now match the actual signatures or signatures after solving #73536.

  • Consistently add the positional-only parameter mark. It is only used in some signatures, but in others it is not clear whether keyword arguments are accepted for all parameters or all parameters are positional-only.
  • Changed the names of some positional-only parameters, for example abs(x) -> abs(number, /).
  • Replace non-Python signatures that use [...] with Python signatures or multiple signatures. For example, str.center(width[, fillchar]) -> str.center(width, fillchar= ' ', /) and str.count(sub[, start[, end]]) -> str.count(sub, start=0, stop=None, /).

Linked PRs

Activity

  1. added 3 commits that reference this issue on Aug 10, 2025
  2. serhiy-storchaka commented on Aug 10, 2025

    @serhiy-storchaka
    MemberAuthor

    And #137611 changes the names of some positional-only parameters to match the documentation if the names in the documentation look better.

  3. serhiy-storchaka commented on Aug 15, 2025

    @serhiy-storchaka
    MemberAuthor

    I recall why str.index() etc did not have machine-readable signatures.

    • They support None as the range limits. The index()`` methods in other sequences only accept integers. I was not sure whether accepting None` is an official feature or an implementation detail.
    • The parameter for the upper index in str-like classes has name end, but in other sequences it has name stop.
  4. added a commit that references this issue on Aug 25, 2025
  5. added a commit that references this issue on Aug 25, 2025
  6. added 2 commits that reference this issue on Aug 25, 2025
  7. added a commit that references this issue on Aug 25, 2025
  8. added a commit that references this issue on Aug 27, 2025
  9. added a commit that references this issue on Sep 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    docsDocumentation in the Doc dir

    Projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions