@@ -187,9 +187,10 @@ determining `supported and unsupported operations
187187The ``extra_items `` Class Parameter
188188-----------------------------------
189189
190- For a TypedDict type that specifies ``extra_items ``, during construction, the
191- value type of each unknown item is expected to be non-required and assignable
192- to the ``extra_items `` argument. For example::
190+ By default ``extra_items `` is unset. For a TypedDict type that specifies
191+ ``extra_items ``, during construction, the value type of each unknown item
192+ is expected to be non-required and assignable to the ``extra_items `` argument.
193+ For example::
193194
194195 class Movie(TypedDict, extra_items=bool):
195196 name: str
@@ -233,15 +234,14 @@ Here, ``'year'`` in ``a`` is an extra key defined on ``Movie`` whose value type
233234is ``int ``. ``'other_extra_key' `` in ``b `` is another extra key whose value type
234235must be assignable to the value of ``extra_items `` defined on ``MovieBase ``.
235236
236- ``extra_items `` is also supported with the functional syntax::
237-
238- Movie = TypedDict("Movie", {"name": str}, extra_items=int | None)
239-
240237.. _typed-dict-closed :
241238
242239The ``closed `` Class Parameter
243240------------------------------
244241
242+ When neither ``extra_items `` nor ``closed=True `` is specified, ``closed=False ``
243+ is assumed.
244+
245245When ``closed=True `` is set, no extra items are allowed. This is equivalent to
246246``extra_items=Never ``, because there can't be a value type that is assignable to
247247:class: `~typing.Never `. It is a runtime error to use the ``closed `` and
@@ -275,8 +275,11 @@ child class is also closed::
275275
276276As a consequence of ``closed=True `` being equivalent to ``extra_items=Never ``,
277277the same rules that apply to ``extra_items=Never `` also apply to
278- ``closed=True ``. It is possible to use ``closed=True `` when subclassing if the
279- ``extra_items `` argument is a read-only type::
278+ ``closed=True ``. While they both have the same effect, ``closed=True `` is
279+ preferred over ``extra_items=Never ``.
280+
281+ It is possible to use ``closed=True `` when subclassing if the ``extra_items ``
282+ argument is a read-only type::
280283
281284 class Movie(TypedDict, extra_items=ReadOnly[str]):
282285 pass
@@ -290,8 +293,7 @@ the same rules that apply to ``extra_items=Never`` also apply to
290293This will be further discussed in
291294:ref: `a later section <pep728-inheritance-read-only >`.
292295
293- When neither ``extra_items `` nor ``closed=True `` is specified, ``closed=False ``
294- is assumed. The TypedDict should allow non-required extra items of value type
296+ The TypedDict should allow non-required extra items of value type
295297``ReadOnly[object] `` during inheritance or assignability checks, to
296298preserve the default TypedDict behavior. Extra keys included in TypedDict
297299object construction should still be caught, as mentioned in TypedDict's
@@ -770,7 +772,7 @@ where ``closed=True`` is required for ``__extra_items__`` to be treated
770772specially, to avoid key collision.
771773
772774Some members of the community concern about the elegance of the syntax.
773- Practiaclly , the key collision with a regular key can be mitigated with
775+ Practically , the key collision with a regular key can be mitigated with
774776workarounds, but since using a reserved key is central to this proposal,
775777there are limited ways forward to address the concerns.
776778
0 commit comments