Skip to content

Issue 1005: Document difference from builtin min() and max().#1008

Merged
bbayles merged 1 commit intomore-itertools:masterfrom
rhettinger:minmax_doc
Jun 18, 2025
Merged

Issue 1005: Document difference from builtin min() and max().#1008
bbayles merged 1 commit intomore-itertools:masterfrom
rhettinger:minmax_doc

Conversation

@rhettinger
Copy link
Copy Markdown
Contributor

No description provided.

2) Comparisons only call `__lt__`, unlike the builtin `max` function
which calls ``__gt__`` instead.
3) Ties are handled differently. The builtin functions always return the
first minimum or maximum value found in the input. In contrast,
Copy link
Copy Markdown
Contributor

@pochmann3 pochmann3 Jun 18, 2025

Choose a reason for hiding this comment

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

This function also always returns the first minimum. It's only the max that can be a later one.

(And it can only be the element immediately after the first max and only if they're a considered pair, i.e., the first max is at an odd index. But I wouldn't mention this. Once you don't get the first max like you do from the max() function, it really doesn't matter which later one you get.)

@bbayles bbayles merged commit 9c4b99c into more-itertools:master Jun 18, 2025
6 checks passed
@bbayles
Copy link
Copy Markdown
Collaborator

bbayles commented Jun 18, 2025

Thanks - I made some edits, but appreciate the clarification on max and deleting the dead ActiveState link.

@bbayles bbayles mentioned this pull request Jun 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants