Open DasVinch opened 7 years ago
I've grown very interested in obtaining and expanding numpy stubs.
However, when it comes to typed ndarrays, I've come to this issue
def a_function(x: np.ndarray[np.float32]) -> None: print('Foo')
is valid for mypy, however the python3 interpreter fails (logically. Here in interpreter, same for type hints in modules.).
In [4]: np.ndarray[np.float32] --------------------------------------------------------------------------- TypeError Traceback (most recent call last) <ipython-input-4-d3b20ca13ba6> in <module>() ----> 1 np.ndarray[np.float32] TypeError: 'type' object is not subscriptable
Question is, how to circumvent this problem ? a typing package style protocol requiring arguments dtype, shape, etc... ?
I've grown very interested in obtaining and expanding numpy stubs.
However, when it comes to typed ndarrays, I've come to this issue
is valid for mypy, however the python3 interpreter fails (logically. Here in interpreter, same for type hints in modules.).
Question is, how to circumvent this problem ? a typing package style protocol requiring arguments dtype, shape, etc... ?