Skip to content

Commit

Permalink
Docs: improve generic typing.NamedTuple example (python#124739)
Browse files Browse the repository at this point in the history
  • Loading branch information
CBerJun authored Sep 29, 2024
1 parent 3f27153 commit 76fbee6
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion Doc/library/typing.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2349,7 +2349,9 @@ types.

Backward-compatible usage::

# For creating a generic NamedTuple on Python 3.11 or lower
# For creating a generic NamedTuple on Python 3.11
T = TypeVar("T")

class Group(NamedTuple, Generic[T]):
key: T
group: list[T]
Expand Down

0 comments on commit 76fbee6

Please sign in to comment.