Closed
Description
I first encountered this issue with Python 3.6.7 and mypy 0.560 from my distribution's repositories, but it also occurs on Python 3.7 and mypy 0.701, and the current master.
This is the code in question:
map(abs, [1])
It works, of course. But running mypy on it raises an error:
test.py:2: error: Argument 1 to "map" has incompatible type "Callable[[SupportsAbs[_T]], _T]"; expected "Callable[[int], _T]"
If I change it to the following code, there are no errors:
map(lambda x: abs(x), [1])
(This is a minimal example, my original code was something like sum(map(abs, list_of_floats))
.)
So, what's the problem here? int
and float
have .__abs__
.