-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
Forbid specialization of TypedDict types #92106
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
Labels
Comments
This was referenced May 1, 2022
serhiy-storchaka
added a commit
to serhiy-storchaka/cpython
that referenced
this issue
May 1, 2022
This was referenced May 1, 2022
serhiy-storchaka
added a commit
to serhiy-storchaka/cpython
that referenced
this issue
May 2, 2022
JelleZijlstra
pushed a commit
that referenced
this issue
May 2, 2022
Closing since we merged #92176. |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
May 2, 2022
…cts (pythonGH-92176) (cherry picked from commit 81fb354) Co-authored-by: Serhiy Storchaka <[email protected]>
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this issue
May 2, 2022
…cts (pythonGH-92176) (cherry picked from commit 81fb354) Co-authored-by: Serhiy Storchaka <[email protected]>
miss-islington
added a commit
that referenced
this issue
May 3, 2022
…H-92176) (cherry picked from commit 81fb354) Co-authored-by: Serhiy Storchaka <[email protected]>
miss-islington
added a commit
that referenced
this issue
May 3, 2022
…H-92176) (cherry picked from commit 81fb354) Co-authored-by: Serhiy Storchaka <[email protected]>
hello-adam
pushed a commit
to hello-adam/cpython
that referenced
this issue
Jun 2, 2022
…cts (pythonGH-92176) (cherry picked from commit 81fb354) Co-authored-by: Serhiy Storchaka <[email protected]>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
typing.TypedDict
creates adict
subclass.dict
is a generic class, and can be specialized, e.g.dict[int, str]
. But TypedDict creates a specialized dictionary class, with different types for values for different keys (and the type of the key is alwaysstr
). It is not a generic class. It does not make sense to specialize it the same way as TypedDict.The last line should be error at run time.
Generic TypedDict (#89026) is a different story.
This change can be made as a side effect of #27663, but I prefer to have a separate discussion for this.
The text was updated successfully, but these errors were encountered: