Skip to content

Require single-axis indexing expressions be provided for each axis #272

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Oct 4, 2021

Conversation

kgryte
Copy link
Contributor

@kgryte kgryte commented Sep 20, 2021

This PR

  • resolves Making indexing more strict? #188 by requiring that single-axis indexing expressions (integer, slice, ellipsis) be provided for each dimension when indexing higher-dimensional arrays. This change was discussed in gh-188 in order to resolve ambiguity as to expected behavior when providing fewer expressions than dimensions (list of lists? flat indexing? etc).

@kgryte kgryte added API change Changes to existing functions or objects in the API. topic: Indexing Array indexing. labels Sep 20, 2021
@kgryte kgryte added this to the v2021 milestone Oct 4, 2021
@kgryte
Copy link
Contributor Author

kgryte commented Oct 4, 2021

As this was discussed and agreed upon in consortium meetings, will go ahead and merge. And refinements/changes can be made in subsequent PRs.

@kgryte kgryte merged commit c587656 into main Oct 4, 2021
@kgryte kgryte deleted the indexing-update branch October 4, 2021 16:36

- An `IndexError` exception must be raised if the number of provided single-axis indexing expressions is greater than `N`.
- Except in the case of providing an ellipsis to index all trailing dimensions (e.g., `A[2:10, ...]`), the number of provided single-axis indexing expressions must equal `N`. For example, if `A` has rank `2`, a single-axis indexing expression must be explicitly provided for both axes (e.g., `A[2:10, :]`). An `IndexError` exception must be raised if the number of provided single-axis indexing expressions is less than `N`.
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just noticed the word "trailing" should not be here. An ellipsis can go anywhere in the index, not just at the end.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also shouldn't this be "should" instead of "must"? Do we want to require this restriction or just limit what the spec requires?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API change Changes to existing functions or objects in the API. topic: Indexing Array indexing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Making indexing more strict?
2 participants