-
-
Notifications
You must be signed in to change notification settings - Fork 32.5k
Closed
Labels
Description
typing.TypedDict
creates a dict
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 always str
). It is not a generic class. It does not make sense to specialize it the same way as TypedDict.
class Point2D(TypedDict):
x: int
y: int
label: str
Point2D[int, str]
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.