This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author CharlieZhao
Recipients 97littleleaf11, AlexWaygood, CharlieZhao, JelleZijlstra, docs@python, sobolevn
Date 2022-02-11.09:42:36
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1644572556.31.0.811251478029.issue46677@roundup.psfhosted.org>
In-reply-to
Content
Indeed, if you use Python keywords or other invalid Python names as keys of TypedDict, we must use the equivalent forms as follows: 

```
Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'in': str})  # OK

Point2D = TypedDict('Point2D', x=int, y=int, in=str)  # Error
```

Maybe we should add this to the docs.


And, it seems that adding examples for inheritance and attributes of TypedDict would make the docs clearer.

Would you mind if I submit a PR for those changes. :)
History
Date User Action Args
2022-02-11 09:42:36CharlieZhaosetrecipients: + CharlieZhao, docs@python, JelleZijlstra, sobolevn, AlexWaygood, 97littleleaf11
2022-02-11 09:42:36CharlieZhaosetmessageid: <1644572556.31.0.811251478029.issue46677@roundup.psfhosted.org>
2022-02-11 09:42:36CharlieZhaolinkissue46677 messages
2022-02-11 09:42:36CharlieZhaocreate