[Numpy-discussion] NumPy dtype API improvement suggestion

Kevin Sheppard kevin.k.sheppard at gmail.com
Sun Jul 26 12:31:58 EDT 2020


Better would be to have an object like NamedTuple in typing that would allow

class Point(DType):
    x: np.int16
    y: np.int16



On Sun, Jul 26, 2020 at 3:22 PM Eyal Kutz <eyal.kutz at gmail.com> wrote:

> I am interested in suggesting an API improvement for NumPy.
> I wish to make it so that the following code:
> @np.dtype
> class Point:
>     x: np.int16
>     y: np.int16
> would be equivalent to the following code:
> Point = np.dtype([('x', np.int16), ('y', np.int16)])
>
> I am willing to submit the code changes required to make this happen.
> _______________________________________________
> NumPy-Discussion mailing list
> NumPy-Discussion at python.org
> https://mail.python.org/mailman/listinfo/numpy-discussion
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20200726/b78add9b/attachment.html>


More information about the NumPy-Discussion mailing list