Skip to content

Commit 980d4a1

Browse files
[3.12] Docs: improve generic typing.NamedTuple example (GH-124739) (#124765)
Docs: improve generic `typing.NamedTuple` example (GH-124739) (cherry picked from commit 76fbee6) Co-authored-by: CBerJun <[email protected]>
1 parent cbea45a commit 980d4a1

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Doc/library/typing.rst

+3-1
Original file line numberDiff line numberDiff line change
@@ -2096,7 +2096,9 @@ types.
20962096

20972097
Backward-compatible usage::
20982098

2099-
# For creating a generic NamedTuple on Python 3.11 or lower
2099+
# For creating a generic NamedTuple on Python 3.11
2100+
T = TypeVar("T")
2101+
21002102
class Group(NamedTuple, Generic[T]):
21012103
key: T
21022104
group: list[T]

0 commit comments

Comments
 (0)