Skip to content

Commit e532760

Browse files
[3.13] Docs: improve generic typing.NamedTuple example (GH-124739) (#124764)
Docs: improve generic `typing.NamedTuple` example (GH-124739) (cherry picked from commit 76fbee6) Co-authored-by: CBerJun <[email protected]>
1 parent 7c7e01c commit e532760

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
@@ -2273,7 +2273,9 @@ types.
22732273

22742274
Backward-compatible usage::
22752275

2276-
# For creating a generic NamedTuple on Python 3.11 or lower
2276+
# For creating a generic NamedTuple on Python 3.11
2277+
T = TypeVar("T")
2278+
22772279
class Group(NamedTuple, Generic[T]):
22782280
key: T
22792281
group: list[T]

0 commit comments

Comments
 (0)