Skip to content

Commit

Permalink
Misc. fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
Viicos committed Oct 30, 2024
1 parent 76dc942 commit 2e0c379
Showing 1 changed file with 15 additions and 15 deletions.
30 changes: 15 additions & 15 deletions peps/pep-0764.rst
Original file line number Diff line number Diff line change
Expand Up @@ -100,11 +100,11 @@ It is possible to define a nested inlined dictionary::

Movie = TypedDict[{'name': str, 'production': TypedDict[{'location': str}]}]

# Note that the following is invalid as per the updated `type_expression` production:
# Note that the following is invalid as per the updated `type_expression` grammar:
Movie = TypedDict[{'name': str, 'production': {'location': str}}]

Although it is not possible to specify any class arguments such as ``total``,
Any :external+typing:term:`type qualifier` can be used for individual fields::
any :external+typing:term:`type qualifier` can be used for individual fields::

Movie = TypedDict[{'name': NotRequired[str], 'year': ReadOnly[int]}]

Expand Down Expand Up @@ -134,6 +134,19 @@ are bound to some outer scope::

**TODO** closed

Typing specification changes
----------------------------

The inlined typed dictionary adds a new kind of
:external+typing:term:`type expression`. As such, the
:external+typing:token:`~expression-grammar:type_expression` production will
be updated to include the inlined syntax:

.. productionlist:: inlined-typed-dictionaries-grammar
new-type_expression: `~expression-grammar:type_expression`
: | <TypedDict> '[' '{' (string: ':' `~expression-grammar:annotation_expression` ',')* '}' ']'
: (where string is any string literal)

Runtime behavior
----------------

Expand All @@ -149,19 +162,6 @@ return the same type (apart from the different :attr:`~type.__name__`)::
T1 = TypedDict('T1', {'a': int})
T2 = TypedDict[{'a': int}]

Typing specification changes
----------------------------

The inlined typed dictionary adds a new kind of
:term:`type expressions <typing:type expression>`. As such, the
:external+typing:token:`~expression-grammar:type_expression` production will
need to be updated to include the inlined syntax:

.. productionlist:: inlined-typed-dictionaries-grammar
new-type_expression: `~expression-grammar:type_expression`
: | <TypedDict> '[' '{' (string: ':' `~expression-grammar:annotation_expression` ',')* '}' ']'
(where string is any string literal)


Backwards Compatibility
=======================
Expand Down

0 comments on commit 2e0c379

Please sign in to comment.