From 231f0ec04ade2a56c2fce44a70c853f786a7cf7f Mon Sep 17 00:00:00 2001 From: CBerJun <121291537+CBerJun@users.noreply.github.com> Date: Sun, 29 Sep 2024 07:07:05 -0400 Subject: [PATCH] Docs: improve generic `typing.NamedTuple` example (GH-124739) (cherry picked from commit 76fbee642e78eacf3866102f31e0ac969b57f1e6) Co-authored-by: CBerJun <121291537+CBerJun@users.noreply.github.com> --- Doc/library/typing.rst | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index db41da60613e4d..40df38c5503696 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -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]