Docs: improve generic `typing.NamedTuple` example (#124739)

This commit is contained in:
CBerJun 2024-09-29 07:07:05 -04:00 committed by GitHub
parent 3f27153e07
commit 76fbee642e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 3 additions and 1 deletions

View File

@ -2349,7 +2349,9 @@ types.
Backward-compatible usage:: 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]): class Group(NamedTuple, Generic[T]):
key: T key: T
group: list[T] group: list[T]