Closed
Description
Bug Report
Mypy emits a spurious error when using the python builtin list
as the first argument to the python builtin map
To Reproduce
from typing import List
x: List[str] = list(map(str, range(5))) # works
y: List[List[str]] = list(map(list, x)) # fails
z: List[str] = list("1") # works
Expected Behavior
I would expect no error. The builtin in list
should satisfy the expected type Callable[[str], List[_T]]
.
(Write what you thought would happen.)
Actual Behavior
running mypy on this yields error: Argument 1 to "map" has incompatible type "Type[List[Any]]"; expected "Callable[[str], List[_T]]"
Your Environment
- Mypy version used: 0.812
- Mypy command-line flags: None
- Mypy configuration options from
mypy.ini
(and other config files): None - Python version used: 3.7.10
- Operating system and version: Windows 10