Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python interpreter error with typed hints #17

Open
DasVinch opened this issue Aug 22, 2017 · 0 comments
Open

Python interpreter error with typed hints #17

DasVinch opened this issue Aug 22, 2017 · 0 comments

Comments

@DasVinch
Copy link

DasVinch commented Aug 22, 2017

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... ?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant