Skip to content

Commit 0fa65a2

Browse files
committed
Correct NamedTuple and TypedDict's type in typing.rst
1 parent 03e6457 commit 0fa65a2

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

Doc/library/typing.rst

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2369,7 +2369,7 @@ These functions and classes should not be used directly as annotations.
23692369
Their intended purpose is to be building blocks for creating and declaring
23702370
types.
23712371

2372-
.. class:: NamedTuple
2372+
.. function:: NamedTuple
23732373

23742374
Typed version of :func:`collections.namedtuple`.
23752375

@@ -2442,6 +2442,9 @@ 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+
24452448
.. versionchanged:: 3.11
24462449
Added support for generic namedtuples.
24472450

@@ -2585,7 +2588,7 @@ types.
25852588
for more details.
25862589

25872590

2588-
.. class:: TypedDict(dict)
2591+
.. function:: TypedDict
25892592

25902593
Special construct to add type hints to a dictionary.
25912594
At runtime it is a plain :class:`dict`.
@@ -2811,6 +2814,9 @@ types.
28112814

28122815
.. versionadded:: 3.8
28132816

2817+
.. versionchanged:: 3.9
2818+
``TypedDict`` is now a function rather than a class.
2819+
28142820
.. versionchanged:: 3.11
28152821
Added support for marking individual keys as :data:`Required` or :data:`NotRequired`.
28162822
See :pep:`655`.

0 commit comments

Comments
 (0)