Skip to content

Add __index__ to array object #263

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 2 commits into from
Sep 14, 2021
Merged

Add __index__ to array object #263

merged 2 commits into from
Sep 14, 2021

Conversation

kgryte
Copy link
Contributor

@kgryte kgryte commented Sep 13, 2021

This PR

  • adds __index__ to the array object, which is called to implement operator.index() (see also PEP 0357).
  • allows a zero-dimensional array to be used as an index when indexing lists and other built-in Python objects supporting slices.
  • resolves gh-231.

@kgryte kgryte added API extension Adds new functions or objects to the API. topic: Indexing Array indexing. labels Sep 13, 2021
Copy link
Member

@rgommers rgommers left a comment

Choose a reason for hiding this comment

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

LGTM, thanks @kgryte

@rgommers rgommers merged commit 5e33e0d into main Sep 14, 2021
@rgommers rgommers deleted the dunder-index branch September 14, 2021 16:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API extension Adds new functions or objects to the API. topic: Indexing Array indexing.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

__index__ method
2 participants