8000 TYP: Fix overload for ``ma.MaskedArray.{min,max,ptp}`` and ``ma.{min,max,ptp}`` for positional ``axis`` and ``out`` by MarcoGorelli · Pull Request #28637 · numpy/numpy · GitHub
[go: up one dir, main page]

Skip to content

TYP: Fix overload for ma.MaskedArray.{min,max,ptp} and ma.{min,max,ptp} for positional axis and out #28637

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
Apr 3, 2025

Conversation

MarcoGorelli
Copy link
Member
@MarcoGorelli MarcoGorelli commented Apr 3, 2025

If out is passed, then that determines the return types, regardless of axis, right? Looks like I'd missed the non-None case last time

Related PRs:

@jorenham jorenham self-requested a review April 3, 2025 14:05
@jorenham
Copy link
Member
jorenham commented Apr 3, 2025

If out is passed, then that determines the return types, regardless of axis, right?

When you pass an array for out, then the function will return that very object.
There may be situations a given axis and out shape are incompatible, causing an error to be raised at runtime. But attempting to prevent this using static typing will require many overloads, and I don't think that the resulting spaghetti is worth that.

@MarcoGorelli MarcoGorelli marked this pull request as ready for review April 3, 2025 14:32
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.

8000

Good catch, and good fix!

@jorenham
Copy link
Member
jorenham commented Apr 3, 2025

Since the PR title doesn't cover all changes, could you briefly list the functions/methods that are affected by this PR? It could also be helpful to link to your previous PR's that are relevant here.

@MarcoGorelli MarcoGorelli changed the title TYP: Fix overload for MaskedArray.min when axis and out are passed positionally TYP: Fix overload for MaskedArray.min, MaskedArray.max, MaskedArray.ptp, np.ma.min, np.ma.max, and np.ma.ptp when axis and out are passed positionally Apr 3, 2025
@MarcoGorelli
Copy link
Member Author

sure, done, thanks!

@jorenham jorenham changed the title TYP: Fix overload for MaskedArray.min, MaskedArray.max, MaskedArray.ptp, np.ma.min, np.ma.max, and np.ma.ptp when axis and out are passed positionally TYP: Fix overload for ma.MaskedArray.{min,max,ptp} and ma.{min,max,ptp} for positional axis and out Apr 3, 2025
@jorenham
Copy link
Member
jorenham commented Apr 3, 2025

I condensed the title a bit; hope you don't mind.

@MarcoGorelli
Copy link
Member Author

🙌 that's better!

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

Thanks again, Marco 😄

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