mirror of
https://github.com/fastapi/fastapi.git
synced 2026-04-05 07:34:12 -04:00
📝 Update Python Types docs, add missing 3.6 / 3.9 example (#4434)
This commit is contained in:
committed by
GitHub
parent
b8ae84d460
commit
7fe79441c1
@@ -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:
|
||||
|
||||
@@ -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)
|
||||
|
||||
4
docs_src/python_types/tutorial008_py39.py
Normal file
4
docs_src/python_types/tutorial008_py39.py
Normal file
@@ -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)
|
||||
Reference in New Issue
Block a user