'mypy fails for numpy sum
This code snippet works:
py -c "import numpy; print(numpy.array([[1,2,3],[4,5,6]]).sum(axis=0) % 2)"
[1 1 1]
But mypy gives an error:
py -m mypy -c "import numpy; print(numpy.array([[1,2,3],[4,5,6]]).sum(axis=0) % 2)"
<string>:1: error: Unsupported operand types for % ("number[Any]" and "int")
<string>:1: note: Left operand is of type "Union[number[Any], ndarray]"
Found 1 error in 1 file (checked 1 source file)
Is this a mypy bug or a numpy bug or a bug in my code snippet?
Solution 1:[1]
This was a numpy bug until numpy 1.20.3 https://github.com/numpy/numpy/issues/18305
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|---|
| Solution 1 | Peter |
