RFC: add support for determining the size of arrays in bytes
Nobody has claimed this yet.
Assessment
- Difficulty
- 5/5
- Estimated time
- Over a week
- Newbie friendliness
- 30/100
Research direction
The issue names no repository files or tests. Start by reviewing the RFC discussion and the described xarray workaround using finfo, iinfo, boolean sizing, and arr.size. Done means reaching a settled array API decision on whether to add arr.nbytes, dtype.itemsize, or both, with the scope and compatibility requirements documented.
Written by the indexing model from the issue text.
Description
In trying to adapt xarray to numpy>=2 (and thus switching testing code from numpy.array_api to array-api-strict), I noticed that the array API does not require the nbytes property on arrays, nor the itemsize 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 and arr.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 with arr.nbytes or arr.dtype.itemsize (or both)?
- Dominant language
- Python
- Stars
- 281
- Forks
- 52
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from data-apis/array-api
-
Difficulty 1/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 70/100
-
Difficulty 5/5 Over a week Newbie friendliness 35/100
-
Maintenance
-
Difficulty 5/5 Over a week Newbie friendliness 25/100
All issues in data-apis/array-api
Similar issues
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
simonw/sqlite-utils#872 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100