Closed
Description
The following sample code shows mypy
generating an error when using python's built-in sum()
. As far as I can tell, there should be no error here, as dividing an int and a float is valid behavior. This can also be seen by the fact that assigning to an intermediary variable suppresses the error.
from typing import List
X: List[float] = [1.]
B = sum(X)
print(1 / B) # no error
print(1 / sum(X)) # error: Argument 1 to "sum" has incompatible type "List[float]"; expected "Iterable[int]"
python 3.6.8, mypy version 0.740
Metadata
Metadata
Assignees
Labels
No labels