Skip to content

Make whether a param has a default be a separate field from quals#118

Open
msullivan wants to merge 2 commits into
mainfrom
default-only
Open

Make whether a param has a default be a separate field from quals#118
msullivan wants to merge 2 commits into
mainfrom
default-only

Conversation

@msullivan
Copy link
Copy Markdown
Collaborator

Also allow it to carry the literal for it, for simple types.

This is extracted from #83, to separate it from the enum stuff.

Two mypy tests xfailed.

msullivan added 2 commits May 18, 2026 19:38
Drop "default" from ParamQuals and add a fourth generic D = Never to
Param. The presence of a default is now expressed by D being a real
type (e.g. the parameter's type) instead of by a string in the qual
set, which makes the default's type available to type-level operators
via the new GetDefault[T: Param] alias.
For simple default types (None, int, str, bytes, bool, enum), store
D = Literal[value] instead of D = ann_type, allowing real values to be
extracted when converting back to inspect.Signature.
@msullivan msullivan requested review from 1st1 and dnwpark May 19, 2026 03:04
@vercel
Copy link
Copy Markdown

vercel Bot commented May 19, 2026

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
python-typemap Ready Ready Preview, Comment May 19, 2026 3:04am

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.

1 participant