From: Sebastián Ramírez Date: Sun, 16 Jan 2022 14:44:08 +0000 (+0100) Subject: 📝 Update Python Types docs, add missing 3.6 / 3.9 example (#4434) X-Git-Tag: 0.72.0~13 X-Git-Url: http://git.ipfire.org/?a=commitdiff_plain;h=7fe79441c1cb7cf3baecc271a3e9680006c8f2c6;p=thirdparty%2Ffastapi%2Ffastapi.git 📝 Update Python Types docs, add missing 3.6 / 3.9 example (#4434) --- diff --git a/docs/en/docs/python-types.md b/docs/en/docs/python-types.md index 76d442855e..fe56dadec0 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 a393385b05..9fb1043bb8 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 0000000000..a393385b05 --- /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)