[Numpy-discussion] Ndarray static typing: Order of generic types
Stephan Hoyer
shoyer at gmail.com
Thu Oct 29 16:35:41 EDT 2020
On Wed, Oct 28, 2020 at 2:44 PM bas van beek <bas.vanbeek at hotmail.com>
wrote:
> Hey all,
>
>
>
> With the recent merging of numpy/numpy#16759
> <https://github.com/numpy/numpy/pull/16759> we’re at the point where `
> ndarray` can be made generic w.r.t. its dtype and shape.
>
> An open question which yet remains is to order in which these two
> parameters should appear (numpy/numpy#16547
> <https://github.com/numpy/numpy/issues/16547>):
>
> · `ndarray[Dtype, Shape]`
>
> · `ndarray[Shape, Dtype]`
>
>
Hi Bas,
Thanks for driving this forward!
Just to speak for myself, I don't think the precise choice matters
very much. There are arguments for consistency both ways. In the end Dtype
and Shape are different enough that I doubt it will be a point of confusion.
Also, I would guess many users will define their own type aliases, so can
write something more succinct like Float64[shape] rather than
ndarray[float64, shape]. We might even consider including some of these in
numpy.typing.
Cheers,
Stephan
>
>
> There has been a some discussion about this question in issue 16547, but a
> consensus has not yet to be reached.
>
> Most people seem to slightly preferring one option over the other.
>
>
>
> Are there any further thoughts on this subject?
>
>
>
> Regards,
>
> Bas van Beek
>
>
> _______________________________________________
> 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: <https://mail.python.org/pipermail/numpy-discussion/attachments/20201029/ebe58c04/attachment-0001.html>
More information about the NumPy-Discussion
mailing list