-
-
Notifications
You must be signed in to change notification settings - Fork 12.2k
Closed
Milestone
Description
Describe the issue:
In https://github.com/numpy/numpy/blob/main/numpy/__init__.pyi#L3692 the return type of call of a vectorized function is defined to always be NDArray[Any], but this is not the case in practice.
As mentioned in the documentation (https://numpy.org/doc/stable/reference/generated/numpy.vectorize.html):
... and returns a single numpy array or a tuple of numpy arrays.
Reproduce the code example:
a = np.array([[1.0, 2.0], [3.0, 4.0]])
def returns_tuple(a):
return (a, a)
b: Tuple[np.ndarray] = np.vectorize(returns_tuple)(a)Error message:
Incompatible types in assignment (expression has type "ndarray[Any, dtype[Any]]", variable has type "Tuple[ndarray[Any, Any]]")NumPy/Python version information:
1.22.1 3.8.10 (default, Nov 26 2021, 20:14:08)
[GCC 9.3.0]
Reactions are currently unavailable