Skip to content

Clarify positional argument handling in TypedDict constructor#2248

Open
BHUVANSH855 wants to merge 2 commits intopython:mainfrom
BHUVANSH855:typeddict-positional-args
Open

Clarify positional argument handling in TypedDict constructor#2248
BHUVANSH855 wants to merge 2 commits intopython:mainfrom
BHUVANSH855:typeddict-positional-args

Conversation

@BHUVANSH855
Copy link
Copy Markdown

This PR updates the TypedDict constructor specification to clarify handling of positional arguments.

The current spec states that only keyword arguments are allowed, but this does not fully reflect runtime behavior and differences across type checkers.

This change:

  • Allows type checkers to accept a single positional argument of TypedDict type
  • Explicitly discourages other positional forms (e.g., dicts, sequences)
  • Adds conformance tests to define expected behavior

This aims to improve consistency while avoiding unsafe or ambiguous cases.

@srittau srittau added the topic: typing spec For improving the typing spec label Apr 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

topic: typing spec For improving the typing spec

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants