Skip to content

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