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

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-30 02:53:13 +02:00 committed by GitHub
parent 7c7e01c2a1
commit e532760f46
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

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