Skip to content

Clarify that a TypeVarTuple default always has to be unpacked #1971

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

rchen152
Copy link
Collaborator

The spec says that:

  1. The default of a TypeVarTuple can be another TypeVarTuple
  2. TypeVarTuples are always unpacked.

Together, these suggest that the default of a TypeVarTuple has to be an unpacked TypeVarTuple, and indeed pyright and mypy both agree. This PR makes that clear and adds a corresponding conformance test.

I don't think this needs a discussion + Typing Council approval, since it's just a clarification of an existing rule, but happy to go through the full process if anyone disagrees.

The spec says that:
1. The default of a TypeVarTuple can be another TypeVarTuple
2. TypeVarTuples are always unpacked.
Together, these suggest that the default of a TypeVarTuple has to be an
*unpacked* TypeVarTuple, and indeed
[pyright](https://pyright-play.net/?pyrightVersion=1.1.386&code=GYJw9gtgBALgngBwJYDsDmUkQWEMoAqiApgGoCGIBArggDbEA0UAqiguQMYDWAUAQGcAjFAC8hEhSq0GACgDkgofICU-AQCYxEhGUo16xBYI3zmAE2LBy1OjFFK1ggMzaiuqQbmKBzs1EtrW3s2Dh4AbSUAXRUgA)
and
[mypy](https://mypy-play.net/?mypy=latest&python=3.12&gist=b6b01c533c7930e1e520765b773d1fe1)
both agree. This PR makes that clear and adds a corresponding conformance test.

I don't think this needs a discussion + Typing Council approval, since it's
just a clarification of an existing rule, but happy to go through the full
process if anyone disagrees.
@erictraut
Copy link
Collaborator

I agree this is just a clarification. The new wording is clearer.

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.

2 participants