diff options
author | CBerJun <121291537+CBerJun@users.noreply.github.com> | 2024-09-29 11:07:05 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2024-09-29 11:07:05 (GMT) |
commit | 76fbee642e78eacf3866102f31e0ac969b57f1e6 (patch) | |
tree | cf1ca09ebb396bd035ec8be983fe5d7174fbc37f /Doc/library | |
parent | 3f27153e077d7e9448e2f081275931968b40cc74 (diff) | |
download | cpython-76fbee642e78eacf3866102f31e0ac969b57f1e6.zip cpython-76fbee642e78eacf3866102f31e0ac969b57f1e6.tar.gz cpython-76fbee642e78eacf3866102f31e0ac969b57f1e6.tar.bz2 |
Docs: improve generic `typing.NamedTuple` example (#124739)
Diffstat (limited to 'Doc/library')
-rw-r--r-- | Doc/library/typing.rst | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 640bc2c..cd8b908 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] |