From 0b2946634b1f59077050b94d9e122c84f052279a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Ram=C3=ADrez?= Date: Sun, 16 Jan 2022 15:40:26 +0100 Subject: [PATCH] =?UTF-8?q?=F0=9F=93=9D=20Update=20Python=20Types=20docs,?= =?UTF-8?q?=20add=20missing=203.6=20/=203.9=20example?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- docs/en/docs/python-types.md | 2 +- docs_src/python_types/tutorial008.py | 5 ++++- docs_src/python_types/tutorial008_py39.py | 4 ++++ 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 docs_src/python_types/tutorial008_py39.py diff --git a/docs/en/docs/python-types.md b/docs/en/docs/python-types.md index 76d442855e85e..fe56dadec0801 100644 --- a/docs/en/docs/python-types.md +++ b/docs/en/docs/python-types.md @@ -252,7 +252,7 @@ The second type parameter is for the values of the `dict`: === "Python 3.9 and above" ```Python hl_lines="1" - {!> ../../../docs_src/python_types/tutorial008.py!} + {!> ../../../docs_src/python_types/tutorial008_py39.py!} ``` This means: diff --git a/docs_src/python_types/tutorial008.py b/docs_src/python_types/tutorial008.py index a393385b05109..9fb1043bb88b5 100644 --- a/docs_src/python_types/tutorial008.py +++ b/docs_src/python_types/tutorial008.py @@ -1,4 +1,7 @@ -def process_items(prices: dict[str, float]): +from typing import Dict + + +def process_items(prices: Dict[str, float]): for item_name, item_price in prices.items(): print(item_name) print(item_price) diff --git a/docs_src/python_types/tutorial008_py39.py b/docs_src/python_types/tutorial008_py39.py new file mode 100644 index 0000000000000..a393385b05109 --- /dev/null +++ b/docs_src/python_types/tutorial008_py39.py @@ -0,0 +1,4 @@ +def process_items(prices: dict[str, float]): + for item_name, item_price in prices.items(): + print(item_name) + print(item_price)