I'm in a need to find the minimum and the maximum in a slice. I could solve this by using the min and max functions after each other, but this will iterate over the slice twice, which is not optimal.
Instead, I think the solution would be to get both in only one iteration. The signature would be similar to this:
True. Okay, I see the special need for the one element case.
Right, I don't like hairy solutions, I like rusty solutions
So, there is a little chance to get this implemented, because Itertools already implements it (and because of that special case, one could avoid with an enum)?
My intuition is that the "it needs a new special-purpose enum" part might actually be the roughest bit -- it opens a huge hole for bikeshedding, which isn't necessarily fatal, but does mean it's harder to be confident that the API is the right one to commit to for perpetuity.