Uh oh!
There was an error while loading.Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork34k
implementation of theminmax function#144382
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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.
Already on GitHub?Sign in to your account
Conversation
Marius-Juston commentedFeb 1, 2026
Also inside the (line 2044 of bltinmodule.c) if (cmp<0) gotoFail_it_item_and_val; and (line 2067 of bltinmodule.c) elsePy_DECREF(maxval); used brackets as, (line 2044 of bltinmodule.c) if (cmp<0) { gotoFail_it_item_and_val;} and (line 2067 of bltinmodule.c) else {Py_DECREF(maxval);} I can add this to my pull request if we want as well. |
Marius-Juston commentedFeb 1, 2026
It might not necessary make complete sense for this function to be part of the |
picnixz commentedFeb 1, 2026 • edited
Loading Uh oh!
There was an error while loading.Please reload this page.
edited
Uh oh!
There was an error while loading.Please reload this page.
Please do not create PRs for features without a discussion. This is not the way contribution works here. The workflow is explained in the devguide which was referenced in this repo's README. |
The
minmaxfunction implementationThis pull request implements the
minmaxfunction, which is very similar to theminandmaxfunctions; however, makes it much more efficient to compute both theminand themaxvalues in a single pass. This is extremely useful for a lot of applications, for example it can be used inside thetextwrap.dedent(#131919 ) function inside Python, theminandmaxfunctions are also very often used inside statical methods to compute the range of values.The advantage of this system is that instead of doing 2 passes inside the dataset / iterable, it can be once.
The function would be defined as:
This probably needs a PEP (I am just familiar enough with the process so I am putting Pull request first)