Skip to content
New issue

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

Specs clarification: Forbid ClassVar and Final within TypedDict body #1890

Merged
merged 4 commits into from
Dec 8, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions docs/spec/class-compat.rst
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,10 @@ annotated in ``__init__`` or other methods, rather than in the class::
def __init__(self, content):
self.content: T = content

``ClassVar`` cannot be used as a qualifier for a :ref:`TypedDict <typeddict>`
item or a :ref:`NamedTuple <namedtuple>` field. Such usage also generates
an error at runtime.

.. _`override`:

``@override``
Expand Down
4 changes: 4 additions & 0 deletions docs/spec/qualifiers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -203,6 +203,10 @@ following should be allowed::
Y: Final = "y"
N = NamedTuple("N", [(X, int), (Y, int)])

``Final`` cannot be used as a qualifier for a :ref:`TypedDict <typeddict>`
item or a :ref:`NamedTuple <namedtuple>` field. Such usage also generates
an error at runtime.

.. _`annotated`:

``Annotated``
Expand Down