TYP: mypy infers that adding/multiplying a npt.NDArray[np.float32]
with a float
promotes dtype to Any
or np.float64
#28805
Labels
Describe the issue:
At run time, adding or multiplying an
ndarray
with dtypenp.float32
with afloat
returns anndarray
with dtypenp.float32
. However, mypy infers that it returns annpt.NDArray[Any]
ornpt.NDArray[np.float64]
.Run time output of code example:
Reproduce the code example:
Error message:
Python and NumPy Versions:
numpy 2.2.5
Python 3.11.9 (tags/v3.11.9:de54cf5, Apr 2 2024, 10:12:12) [MSC v.1938 64 bit (AMD64)]
Type-checker version and settings:
mypy 1.15.0
Command line:
mypy.ini:
Additional typing packages.
mypy_extensions 1.1.0
typing_extensions 4.13.2
The text was updated successfully, but these errors were encountered: