Код: Выделить всё
from typing import Dict
d = Dict[str, int]
ln = ['a', 'b', 'c']
lc = [3, 5, 7]
d = dict(zip(ln, lc))
print(ln)
print(lc)
print(d)
Код: Выделить всё
% python3 blurb.py
['a', 'b', 'c']
[3, 5, 7]
{'a': 3, 'b': 5, 'c': 7}
Код: Выделить всё
% mypy blurb.py
blurb.py:6: error: Cannot assign multiple types to name "d" without an explicit "Type[...]" annotation
blurb.py:6: error: Incompatible types in assignment (expression has type "Dict[str, int]", variable has type "Type[Dict[Any, Any]]")
Found 2 errors in 1 file (checked 1 source file)
Подробнее здесь: https://stackoverflow.com/questions/637 ... -two-lists