10000 TYP: Type ``MaskedArray.nonzero`` by MarcoGorelli · Pull Request #28845 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

TYP: Type MaskedArray.nonzero #28845

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 1 commit into from
May 1, 2025
Merged

Conversation

MarcoGorelli
Copy link
Member

No description provided.

@jorenham jorenham self-requested a review April 28, 2025 15:02
@MarcoGorelli MarcoGorelli marked this pull request as ready for review April 28, 2025 15:29
Copy link
Member
@jorenham jorenham left a comment

Choose a reason for hiding this comment

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

The return tuple always consists of a 1-d arrays, right? That might be a way to narrow it a bit further.

Another possible way to improve this, would be exclude length-0 tuples from the return type (nonzero requires at least 1-d arrays). With the fancy Python 3.11+ syntax, that can be written as tuple[_, *tuple[_, ...]].

@jorenham jorenham added the component: numpy.ma masked arrays label Apr 28, 2025
@MarcoGorelli MarcoGorelli marked this pull request as draft April 28, 2025 20:02
@MarcoGorelli MarcoGorelli changed the title TYP: Type np.ma.nonzero and MaskedArray.nonzero TYP: Type MaskedArray.nonzero May 1, 2025
@MarcoGorelli MarcoGorelli marked this pull request as ready for review May 1, 2025 11:20
Copy link
Member
@jorenham jorenham left a comment

Choose a reason for hiding this comment

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

looks pretty

@jorenham jorenham merged commit 1752876 into numpy:main May 1, 2025
74 of 75 checks passed
@jorenham
Copy link
Member
jorenham commented May 1, 2025

Thanks Marco :)

MaanasArora pushed a commit to MaanasArora/numpy that referenced this pull request May 8, 2025
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.

2 participants
0