Content-Length: 257468 | pFad | http://github.com/numpy/numpy/pull/29370

71 ENH: Allow subscript access for `np.bool` by adding `__class_getitem__` by riku-sakamoto · Pull Request #29370 · numpy/numpy · GitHub
Skip to content

ENH: Allow subscript access for np.bool by adding __class_getitem__ #29370

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

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

riku-sakamoto
Copy link
Contributor

@riku-sakamoto riku-sakamoto commented Jul 13, 2025

Fixes #29247

This PR adds support for subscript access to np.bool by implementing a __class_getitem__ method.

Implementation Details

  • Implements booleantype_class_getitem_abc, following the pattern used for other scalar types.
  • Adds __class_getitem__ to the np.bool type.

@ngoldbaum

I created new PR.
Would you mind reviewing this when you get a chance? Thank you!

Fixes numpy#29247. Implements `booleantype_class_getitem_abc` and adds a `__class_getitem__` method to `np.bool` to enable subscript access (e.g., `np.bool[int]`).
@riku-sakamoto riku-sakamoto marked this pull request as ready for review July 13, 2025 20:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

BUG: np.bool is not subscriptable at run time
1 participant








ApplySandwichStrip

pFad - (p)hone/(F)rame/(a)nonymizer/(d)eclutterfier!      Saves Data!


--- a PPN by Garber Painting Akron. With Image Size Reduction included!

Fetched URL: http://github.com/numpy/numpy/pull/29370

Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy