https://github.com/python/cpython/commit/980d4a1befe29b06d8af1ce82e70d983195e7b0e commit: 980d4a1befe29b06d8af1ce82e70d983195e7b0e branch: 3.12 author: Miss Islington (bot) <[email protected]> committer: AlexWaygood <[email protected]> date: 2024-09-29T11:13:25Z summary:
[3.12] Docs: improve generic `typing.NamedTuple` example (GH-124739) (#124765) Docs: improve generic `typing.NamedTuple` example (GH-124739) (cherry picked from commit 76fbee642e78eacf3866102f31e0ac969b57f1e6) Co-authored-by: CBerJun <[email protected]> files: M Doc/library/typing.rst diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 0bab1df6f4f254..8b464be14b059e 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -2096,7 +2096,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]
