]> git.ipfire.org Git - thirdparty/fastapi/fastapi.git/commitdiff
📝 Update Python Types docs, add missing 3.6 / 3.9 example (#4434)
authorSebastián Ramírez <tiangolo@gmail.com>
Sun, 16 Jan 2022 14:44:08 +0000 (15:44 +0100)
committerGitHub <noreply@github.com>
Sun, 16 Jan 2022 14:44:08 +0000 (15:44 +0100)
docs/en/docs/python-types.md
docs_src/python_types/tutorial008.py
docs_src/python_types/tutorial008_py39.py [new file with mode: 0644]

index 76d442855e85e580dba3b831faf96db32a40b07a..fe56dadec080175d5543fa72e079c10444c08606 100644 (file)
@@ -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:
index a393385b0510927ea45a45307c591f7a7994e7a4..9fb1043bb88b55290ed103929f9974bede98562a 100644 (file)
@@ -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 (file)
index 0000000..a393385
--- /dev/null
@@ -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)