[Numpy-discussion] Proposed change in construction of structured dtypes with a shape-(1, ) field

Antony Lee anntzer.lee at gmail.com
Mon May 20 10:51:54 EDT 2019


In #13112/#13326, I proposed to change the semantics of constructing
structured dtypes with a shape-(1,) field (with a deprecation period).
Currently, a construct like `np.empty(1, ("a", int, 1))` is treated as a
shape-() field, i.e. the same as `np.empty(1, ("a", int))`; the PR proposes
to (ultimately) change it to mean using a shape-(1,) field, i.e.
`np.empty(1, ("a", int, 1))`.  This is consistent e.g. with `np.empty(1,
("a", int, 2))` being equivalent to `np.empty(1, ("a", int, (2,)))` and
more generally with numpy accepting a scalar integer n to mean shape-(n,)
in many places (e.g. `np.zeros(3)` and `np.zeros((3,))`).

Thoughts?

Antony
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/numpy-discussion/attachments/20190520/460eb1f6/attachment.html>


More information about the NumPy-Discussion mailing list