RFC: add support for determining the size of arrays in bytes #789
Labels
API extension
Adds new functions or objects to the API.
Needs Discussion
Needs further discussion.
RFC
Request for comments. Feature requests and proposed changes.
In trying to adapt
xarray
tonumpy>=2
(and thus switching testing code fromnumpy.array_api
toarray-api-strict
), I noticed that the array API does not require thenbytes
property on arrays, nor theitemsize
property on dtypes.Thus, the only way to figure out the size of an array we could find was to create a function that dispatches to
finfo
/iinfo
(and returns a hard-coded 1 byte for booleans), then use that andarr.size
to compute the size of the array. This feels like more work than should be necessary, so I wonder if you would be open to extending the array API witharr.nbytes
orarr.dtype.itemsize
(or both)?The text was updated successfully, but these errors were encountered: