Closed
Description
defaultdict's documentation suggests passing list
as an argument to defaultdict - https://docs.python.org/2/library/collections.html#defaultdict-examples
mypy complains when I do this however
from collections import defaultdict
foo = defaultdict(list)
bar = defaultdict(dict)
Results in:
default_dict_example.py, line 3: Argument 1 to "defaultdict" has incompatible type List[_T]; expected Callable[[], List[_T]]
default_dict_example.py, line 3: Need type annotation for variable
default_dict_example.py, line 4: Argument 1 to "defaultdict" has incompatible type Dict[_KT, _VT]; expected Callable[[], Dict[_KT, _VT]]
default_dict_example.py, line 4: Need type annotation for variable