[3.12] Docs: improve generic typing.NamedTuple example (GH-124739) (#124765)

Docs: improve generic `typing.NamedTuple` example (GH-124739)
(cherry picked from commit 76fbee642e)

Co-authored-by: CBerJun <121291537+CBerJun@users.noreply.github.com>
This commit is contained in:
Miss Islington (bot) 2024-09-29 13:13:25 +02:00 committed by GitHub
parent cbea45ad74
commit 980d4a1bef
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -2096,7 +2096,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]