Skip to content

Commit f3fdda9

Browse files
committed
Update docs examples to use clearer key names
Example taken from PEP 764 draft
1 parent 41d8a1f commit f3fdda9

File tree

2 files changed

+8
-8
lines changed

2 files changed

+8
-8
lines changed

docs/source/command_line.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1190,16 +1190,16 @@ List of currently incomplete/experimental features:
11901190

11911191
.. code-block:: python
11921192
1193-
def test_values() -> TypedDict[{"int": int, "str": str}]:
1194-
return {"int": 42, "str": "test"}
1193+
def get_movie() -> TypedDict[{"name": str, "year": int}]:
1194+
return {"name": "Blade Runner", "year": 1982}
11951195
11961196
* ``InlineTypedDict``: this feature enables non-standard syntax for inline
11971197
:ref:`TypedDicts <typeddict>`, for example:
11981198

11991199
.. code-block:: python
12001200
1201-
def test_values() -> {"int": int, "str": str}:
1202-
return {"int": 42, "str": "test"}
1201+
def get_movie() -> {"name": str, "year": int}:
1202+
return {"name": "Blade Runner", "year": 1982}
12031203
12041204
12051205
Miscellaneous

docs/source/typed_dict.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -303,8 +303,8 @@ to use inline TypedDict syntax. For example:
303303

304304
.. code-block:: python
305305
306-
def test_values() -> TypedDict[{"int": int, "str": str}]:
307-
return {"int": 42, "str": "test"}
306+
def get_movie() -> TypedDict[{"name": str, "year": int}]:
307+
return {"name": "Blade Runner", "year": 1982}
308308
309309
class Response(TypedDict):
310310
status: int
@@ -318,8 +318,8 @@ to use inline TypedDict syntax. For example:
318318

319319
.. code-block:: python
320320
321-
def test_values() -> {"int": int, "str": str}:
322-
return {"int": 42, "str": "test"}
321+
def get_movie() -> {"name": str, "year": int}:
322+
return {"name": "Blade Runner", "year": 1982}
323323
324324
This legacy syntax can be enabled using ``--enable-incomplete-feature=InlineTypedDict``.
325325
Due to ambiguity with a regular variables, the legacy syntax may only be used in

0 commit comments

Comments
 (0)