TypedDict alternative definition syntax with keyword args is confusing · Issue #981 · python/typing (original) (raw)
Navigation Menu
- Explore
- Pricing
Provide feedback
Saved searches
Use saved searches to filter your results more quickly
Appearance settings
Description
Originally opened in https://bugs.python.org/issue46066.
Related discussion: python/mypy#2492
According to the documentation, there are two additional equivalent syntax for TypedDict definition:
Point2D = TypedDict('Point2D', x=int, y=int, label=str) Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})
However, the former one is quite confusing since we have the total
keyword arg for TypedDict. In addition, PEP589 doesn't have this syntax.
I think we could just deprecated it and remove it from the doc.