From: CBerJun <121291537+CBerJun@users.noreply.github.com> Date: Sun, 29 Sep 2024 11:07:05 +0000 (-0400) Subject: Docs: improve generic `typing.NamedTuple` example (#124739) X-Git-Tag: v3.14.0a1~252 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=76fbee642e78eacf3866102f31e0ac969b57f1e6;p=thirdparty%2FPython%2Fcpython.git Docs: improve generic `typing.NamedTuple` example (#124739) --- diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 640bc2c9d503..cd8b90854b0e 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -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]