Skip to content

Support indexing with any type which implmented __index__#3210

Open
aisk wants to merge 1 commit intoml-explore:mainfrom
aisk:index
Open

Support indexing with any type which implmented __index__#3210
aisk wants to merge 1 commit intoml-explore:mainfrom
aisk:index

Conversation

@aisk
Copy link
Contributor

@aisk aisk commented Mar 5, 2026

Proposed changes

Any type which implemented __index__ can be used to indexing mlx array, so we can use numpy scalar to indexing array.

bool is not supported also it implemented __index__ (actually, bool is a subclass of int) because it's to quirky.

Close: #2710

Checklist

Put an x in the boxes that apply.

  • I have read the CONTRIBUTING document
  • I have run pre-commit run --all-files to format my code / installed pre-commit prior to committing changes
  • I have added tests that prove my fix is effective or that my feature works
  • I have updated the necessary documentation (if needed)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support of numpy scalar indexing

1 participant