This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
The *extra_items* argument is also inherited through subclassing. It is unset
by default, and it may not be used together with the *closed* argument.
A ``TypedDict`` cannot inherit from a non-\ ``TypedDict`` class,
except for :class:`Generic`. For example::
Expand Down
Expand Up
@@ -2825,8 +2856,8 @@ types.
group: list[T]
A ``TypedDict`` can be introspected via annotations dicts
(see :ref:`annotations-howto` for more information on annotations best practices),
:attr:`__total__`, :attr:`__required_keys__`, and :attr:`__optional_keys__`.
(see :ref:`annotations-howto` for more information on annotations best practices)
and the following attributes:
.. attribute:: __total__
Expand Down
Expand Up
@@ -2896,8 +2927,6 @@ types.
``__required_keys__`` and ``__optional_keys__`` rely on may not work
properly, and the values of the attributes may be incorrect.
Support for :data:`ReadOnly` is reflected in the following attributes:
.. attribute:: __readonly_keys__
A :class:`frozenset` containing the names of all read-only keys. Keys
Expand All
@@ -2912,6 +2941,14 @@ types.
.. versionadded:: 3.13
.. attribute:: __closed__
The value of the *closed* class argument. It can be ``True``, ``False``, or :data:`None`.
.. attribute:: __extra_items__
The value of the *extra_items* class argument. It can be a valid type or :data:`NoExtraItems`.
See the `TypedDict <https://typing.python.org/en/latest/spec/typeddict.html#typeddict>`_ section in the typing documentation for more examples and detailed rules.
.. versionadded:: 3.8
Expand All
@@ -2931,7 +2968,10 @@ types.
Removed support for the keyword-argument method of creating ``TypedDict``\ s.
.. versionchanged:: 3.13
Support for the :data:`ReadOnly` qualifier was added.
Support for the :data:`ReadOnly` qualifier was added. See :pep:`705`.
.. versionchanged:: next
Support for the *closed* and *extra_items* class arguments was added. See :pep:`728`.
Protocols
Expand Down
Expand Up
@@ -3679,6 +3719,21 @@ Introspection helpers
.. versionadded:: 3.13
.. data:: NoExtraItems
A :class:`sentinel` object used to indicate that a :class:`TypedDict`
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
gh-137840: Document PEP 728 #149207
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
gh-137840: Document PEP 728 #149207
Filter by extension
Viewed files
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There are no files selected for viewing
Uh oh!
There was an error while loading. Please reload this page.