@@ -2369,7 +2369,7 @@ These functions and classes should not be used directly as annotations.
23692369Their intended purpose is to be building blocks for creating and declaring
23702370types.
23712371
2372- .. class :: NamedTuple
2372+ .. function :: NamedTuple
23732373
23742374 Typed version of :func: `collections.namedtuple `.
23752375
@@ -2442,6 +2442,10 @@ types.
24422442 Removed the ``_field_types `` attribute in favor of the more
24432443 standard ``__annotations__ `` attribute which has the same information.
24442444
2445+ .. versionchanged :: 3.9
2446+ ``NamedTuple `` is now a function rather than a class.
2447+ It can still be used as a class base, as described above.
2448+
24452449 .. versionchanged :: 3.11
24462450 Added support for generic namedtuples.
24472451
@@ -2585,10 +2589,10 @@ types.
25852589 for more details.
25862590
25872591
2588- .. class :: TypedDict(dict)
2592+ .. function :: TypedDict
25892593
25902594 Special construct to add type hints to a dictionary.
2591- At runtime it is a plain :class: `dict `.
2595+ At runtime " :class: ` !TypedDict ` instances" are simply :class: `dicts < dict> `.
25922596
25932597 ``TypedDict `` declares a dictionary type that expects all of its
25942598 instances to have a certain set of keys, where each key is
@@ -2811,6 +2815,10 @@ types.
28112815
28122816 .. versionadded :: 3.8
28132817
2818+ .. versionchanged :: 3.9
2819+ ``TypedDict `` is now a function rather than a class.
2820+ It can still be used as a class base, as described above.
2821+
28142822 .. versionchanged :: 3.11
28152823 Added support for marking individual keys as :data: `Required ` or :data: `NotRequired `.
28162824 See :pep: `655 `.
0 commit comments