8000 Docs: improve generic `typing.NamedTuple` example (#124739) · python/cpython@76fbee6 · GitHub
[go: up one dir, main page]

Skip to content

Commit 76fbee6

Browse files
authored
Docs: improve generic typing.NamedTuple example (#124739)
1 parent 3f27153 commit 76fbee6

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

Doc/library/typing.rst

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2349,7 +2349,9 @@ types.
23492349

23502350
Backward-compatible usage::
23512351

2352-
# For creating a generic NamedTuple on Python 3.11 or lower
2352+
# For creating a generic NamedTuple on Python 3.11
2353+
T = TypeVar("T")
2354+
23532355
class Group(NamedTuple, Generic[T]):
23542356
key: T
23552357
group: list[T]

0 commit comments

Comments
 (0)
0