https://github.com/python/cpython/commit/76fbee642e78eacf3866102f31e0ac969b57f1e6
commit: 76fbee642e78eacf3866102f31e0ac969b57f1e6
branch: main
author: CBerJun <[email protected]>
committer: AlexWaygood <[email protected]>
date: 2024-09-29T12:07:05+01:00
summary:
Docs: improve generic `typing.NamedTuple` example (#124739)
files:
M Doc/library/typing.rst
diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst
index 640bc2c9d503bc..cd8b90854b0e94 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]
_______________________________________________
Python-checkins mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-checkins.python.org/
Member address: [email protected]