[Numpy-discussion] Type annotations for NumPy

Chris Barker - NOAA Federal chris.barker at noaa.gov
Tue Nov 28 18:59:14 EST 2017

(a) it would be good if NumPy type annotations could include an
“array_like” type that allows lists, tuples, etc.

I think that would be a sequence — already supported by the Typing system.

(b) I’ve always thought (since PEP561) that it would be cool for type
annotations to replace compiler type annotations for e.g. Cython and Numba.
Is this in the realm of possibility for the future?

Well, this was brought up early in the Typing discussion, and it was made
clear that these kinds of truly static types, as needed by Cython, was a
non-goal of the project.

That being said, perhaps it could be made to work with a bunch of
additional type objects.

And we should lol lol to Cython for ideas about how to type numpy arrays.

One note: in addition to shape (rank) and types, there is contiguous and C
or F order. That may want to be considered.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20171128/e7a68f66/attachment.html>

More information about the NumPy-Discussion mailing list