Skip to content

TypedDict alternative definition syntax with keyword args is confusing #981

Closed
python/cpython
#31126
@97littleleaf11

Description

@97littleleaf11

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.

Metadata

Metadata

Assignees

No one assigned

    Labels

    topic: otherOther topics not covered

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions