Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion peps/pep-0728.rst
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ the ``extra_items`` argument::

``extra_items`` is inherited through subclassing::

class MovieBase(TypedDict, extra_items=int | None):
class MovieBase(TypedDict, extra_items=ReadOnly[int | None]):
name: str

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

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

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