@@ -1247,26 +1247,28 @@ These are not used in annotations. They are building blocks for declaring types.
12471247
12481248 assert Point2D(x=1, y=2, label='first') == dict(x=1, y=2, label='first')
12491249
1250- The type info for introspection can be accessed via ``Point2D.__annotations__ ``
1251- and ``Point2D.__total__ ``. To allow using this feature with older versions
1252- of Python that do not support :pep: `526 `, ``TypedDict `` supports two additional
1253- equivalent syntactic forms::
1250+ The type info for introspection can be accessed via ``Point2D.__annotations__ ``,
1251+ ``Point2D.__total__ ``, ``Point2D.__required_keys__ ``, and
1252+ ``Point2D.__optional_keys__ ``.
1253+ To allow using this feature with older versions of Python that do not
1254+ support :pep: `526 `, ``TypedDict `` supports two additional equivalent
1255+ syntactic forms::
12541256
12551257 Point2D = TypedDict('Point2D', x=int, y=int, label=str)
12561258 Point2D = TypedDict('Point2D', {'x': int, 'y': int, 'label': str})
12571259
1258- By default, all keys must be present in a TypedDict. It is possible
1259- to override this by specifying totality.
1260+ By default, all keys must be present in a `` TypedDict `` . It is possible to
1261+ override this by specifying totality.
12601262 Usage::
12611263
1262- class point2D (TypedDict, total=False):
1264+ class Point2D (TypedDict, total=False):
12631265 x: int
12641266 y: int
12651267
1266- This means that a point2D TypedDict can have any of the keys omitted. A type
1267- checker is only expected to support a literal False or True as the value of
1268- the total argument. True is the default, and makes all items defined in the
1269- class body be required.
1268+ This means that a `` Point2D `` `` TypedDict `` can have any of the keys
1269+ omitted. A type checker is only expected to support a literal `` False `` or
1270+ `` True `` as the value of the `` total `` argument. `` True `` is the default,
1271+ and makes all items defined in the class body required.
12701272
12711273 See :pep: `589 ` for more examples and detailed rules of using ``TypedDict ``.
12721274
@@ -1980,4 +1982,3 @@ Constant
19801982 (see :pep: `563 `).
19811983
19821984 .. versionadded :: 3.5.2
1983-
0 commit comments