Skip to content

PEP 827: Split whether a param has a default out from "quals"#4979

Open
msullivan wants to merge 1 commit into
python:mainfrom
msullivan:default
Open

PEP 827: Split whether a param has a default out from "quals"#4979
msullivan wants to merge 1 commit into
python:mainfrom
msullivan:default

Conversation

@msullivan
Copy link
Copy Markdown
Contributor

Q/.quals becomes K/.kind, and we add D/.default to track whether there
is a default. It should be the type of the default if it exists,
otherwise Never. Tracking the type here allows specifying a
Literal in order to track a specific value, similar to what we
support for Member.

There is a possible follow-up to use an enum for the ParamKind
instead of string literals but I'm not certain about it yet.

  • Change is either:
    • To a Draft PEP
    • To an Accepted or Final PEP, with Steering Council approval
    • To fix an editorial issue (markup, typo, link, header, etc)
  • PR title prefixed with PEP number (e.g. PEP 123: Summary of changes)

Q/.quals becomes K/.kind, and we add D/.default to track whether there
is a default. It should be the type of the default if it exists,
otherwise `Never`. Tracking the type here allows specifying a
`Literal` in order to track a specific value, similar to what we
support for `Member`.

There is a possible follow-up to use an enum for the `ParamKind`
instead of string literals but I'm not certain about it yet.
@msullivan msullivan requested a review from 1st1 as a code owner May 20, 2026 17:26
@read-the-docs-community
Copy link
Copy Markdown

Documentation build overview

📚 pep-previews | 🛠️ Build #32781472 | 📁 Comparing a12dfc3 against latest (c1f8b92)

  🔍 Preview build  

6 files changed · ± 6 modified

± Modified

Comment thread peps/pep-0827.rst

or, using the type abbreviations we provide::
or, using the type abbreviations we provide (though this version will not track
specific values for the defaults)::
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

This wording is a bit confusing. Anyways, maybe we should just add the default as a param with Never defaults.

Comment thread peps/pep-0827.rst

The argument ``K``, of type ``ParamKind``, represents the parameter
kind of the parameter. The default "positional or named" kind of
argument is represented as ``Never``. It is an error to create
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

seems like a strange use of Never. I would try to align these kinds with the ones in inspect: https://docs.python.org/3.15/library/inspect.html#inspect.Parameter.kind

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants