PEP 827: Split whether a param has a default out from "quals"#4979
Open
msullivan wants to merge 1 commit into
Open
PEP 827: Split whether a param has a default out from "quals"#4979msullivan wants to merge 1 commit into
msullivan wants to merge 1 commit into
Conversation
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.
Documentation build overview
6 files changed ·
|
dnwpark
approved these changes
May 20, 2026
|
|
||
| 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):: |
There was a problem hiding this comment.
This wording is a bit confusing. Anyways, maybe we should just add the default as a param with Never defaults.
|
|
||
| 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 |
Member
There was a problem hiding this comment.
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
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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 aLiteralin order to track a specific value, similar to what wesupport for
Member.There is a possible follow-up to use an enum for the
ParamKindinstead of string literals but I'm not certain about it yet.
PEP 123: Summary of changes)