Charlie Zhao <[email protected]> added the comment:
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. :)
----------
nosy: +CharlieZhao
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue46677>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com