8000 TYP: Type ``MaskedArray.{argmin, argmax}`` and ``np.ma.{argmin, argmax}`` by MarcoGorelli · Pull Request #28638 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

TYP: Type MaskedArray.{argmin, argmax} and np.ma.{argmin, argmax} #28638

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 6 commits into from
Apr 3, 2025

Conversation

MarcoGorelli
Copy link
Member

No description provided.

@jorenham jorenham self-requested a review April 3, 2025 15:05
@tylerjereddy tylerjereddy added the component: numpy.ma masked arrays label Apr 3, 2025
@MarcoGorelli MarcoGorelli marked this pull request as ready for review April 3, 2025 17:32
@MarcoGorelli MarcoGorelli marked this pull request as draft April 3, 2025 17:33
@MarcoGorelli MarcoGorelli marked this pull request as ready for review April 3, 2025 18: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.

Last nitpick: The np.ma.MaskedArray methods should have the exact same signature as the functions in np.ma. For the most part, that is currently the case. But there's a tiny difference: self isn't positional-only.

@MarcoGorelli
Copy link
Member Author

true, i was just thinking that you might want to discourage people writing np.ma.argmin(self=arr), but I can rename to obj and remove the positional-only req if you prefer

@jorenham
Copy link
Member
jorenham commented Apr 3, 2025

true, i was just thinking that you might want to discourage people writing np.ma.argmin(self=arr), but I can rename to obj and remove the positional-only req if you prefer

I think you went with the most correct option here. Unfortunately self isn't positional-only at runtime, so stubtest would complain about it if we'd deviate from it here by making both self's pos-only.

@jorenham jorenham merged commit a046296 into numpy:main Apr 3, 2025
74 checks passed
@jorenham
Copy link
Member
jorenham commented Apr 3, 2025

Thanks Marco

MaanasArora pushed a commit to MaanasArora/numpy that referenced this pull request Apr 11, 2025
…x}`` (numpy#28638)

* TYP: Type ``MaskedArray.argmin`` and ``MaskedArray.argmax``

* type `axis: SupportsIndex | None`, add test which would have failed

* 🎨

* fixup

* 🎨

* align sigs
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.

3 participants
0