PyDocs

Nav

Development Tools

TypedDict.__optional_keys__

typing

attribute of TypedDict · Added in 3.9
Point2D.__required_keys__ and Point2D.__optional_keys__ return frozenset objects containing required and non-required keys, respectively.
1 Example
>>> class Point2D(TypedDict, total=False):
...     x: int
...     y: int
...
>>> class Point3D(Point2D):
...     z: int
...
>>> Point3D.__required_keys__ == frozenset({'z'})
True
>>> Point3D.__optional_keys__ == frozenset({'x', 'y'})
True
from the Python docs
See Also
No see-alsos for typing/TypedDict.__optional_keys__
0 Notes
No notes for TypedDict.__optional_keys__