Skip to content

Commit cea3044

Browse files
authored
PEP 827: Fix PartialTD example (#4844)
Oops, it was not actually creating a NewTypedDict.
1 parent 483f561 commit cea3044

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

peps/pep-0827.rst

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1236,9 +1236,9 @@ We present implementations of a selection of them::
12361236
# PartialTD<T>
12371237
# Like Partial, but for TypedDicts: wraps all fields in NotRequired
12381238
# rather than making them T | None.
1239-
type PartialTD[T] = typing.NewProtocol[
1239+
type PartialTD[T] = typing.NewTypedDict[
12401240
*[
1241-
typing.Member[p.name, NotRequired[p.type], p.quals]
1241+
typing.Member[p.name, p.type, p.quals | Literal["NotRequired"]]
12421242
for p in typing.Iter[typing.Attrs[T]]
12431243
]
12441244
]

0 commit comments

Comments
 (0)