Closed
Description
Describe the issue:
A operation between a NDArray[Any]
array and an integer, as in the code example, makes Mypy infer the result as
numpy.ndarray[Any, numpy.dtype[numpy.signedinteger[Any]]]
. This is an error, as the result could also be a floating point array, or even a complex one.
Reproduce the code example:
from numpy.typing import NDArray
def f(arr: NDArray[Any]) -> None:
reveal_type(arr + 2)
Error message:
No response
NumPy/Python version information:
1.21.2 3.7.6 (default, Jan 8 2020, 19:59:22)
[GCC 7.3.0]