Repository navigation
docs: record the 0-d array return of scalar indexing in the 3.0 migra… - #4694
Open
RafaelPulzi wants to merge 1 commit into
Open
RafaelPulzi wants to merge 1 commit into
RafaelPulzi wants to merge 1 commit into
Conversation
…tion guide Scalar indexing returned a NumPy scalar in Zarr-Python 2 and returns a 0-dimensional numpy.ndarray in Zarr-Python 3, following the Python array API standard. Arrays whose shape is () changed in the other direction. The migration guide covered neither, so the change was only visible from the Array.__getitem__ doctest.
d-v-b
approved these changes
Dec 4, 2026
Contributor
|
thank you! |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
The migration guide doesn't mention what happened to scalar indexing. Indexing a single element returned a NumPy scalar in Zarr-Python 2 and returns a 0-dimensional numpy.ndarray in Zarr-Python 3, which is what the Python array API standard specifies for getitem. Arrays whose shape is () went the other way: reading one gave a 0-d array in v2 and gives a scalar in v3. Right now the only place either behaviour shows up is the Array.getitem doctest.
This adds item 4 to "The Array class" with both directions and the two ways to get a scalar back, item() and [()], plus a link to the standard's getitem page. Nothing outside the docs changed.
Refs #3741 rather than closing it: that issue also asks whether getitem should return something different, which is a separate decision.