Skip to content

Commit e7e5af4

Browse files
authored
PEP 728: Fix minor issues with examples (#4475)
Jukka pointed out the incorrect use of extra_items here: https://discuss.python.org/t/pep-728-typeddict-with-typed-extra-items/45443/157 Also fixed a minor issue with a class missing its body.
1 parent f5e2ca9 commit e7e5af4

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

peps/pep-0728.rst

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ the ``extra_items`` argument::
215215

216216
``extra_items`` is inherited through subclassing::
217217

218-
class MovieBase(TypedDict, extra_items=int | None):
218+
class MovieBase(TypedDict, extra_items=ReadOnly[int | None]):
219219
name: str
220220

221221
class Movie(MovieBase):
@@ -380,6 +380,7 @@ unless it is declared to be ``ReadOnly`` in the superclass::
380380
pass
381381

382382
class Child(Parent, extra_items=int): # Not OK. Like any other TypedDict item, extra_items's type cannot be changed
383+
pass
383384

384385
Second, ``extra_items=T`` effectively defines the value type of any unnamed
385386
items accepted to the TypedDict and marks them as non-required. Thus, the above

0 commit comments

Comments
 (0)