How is max supposed to work, especially key.
Jussi Piitulainen
jpiitula at ling.helsinki.fi
Thu Dec 4 05:51:48 EST 2014
Albert van der Horst writes:
> Chris Angelico wrote:
> > If there's no clear maximum, it can't do any better than
> > that. It's still returning something for which there is no
> > greater.
>
> I agree that it is a useful function and that it is doing
> the right thing. What is wrong is the name.
> I refer to the fact that it is not returning the maximum.
> It returns the iterator value that leads to the maximum.
> A function that doesn't return a maximum shouldn't be called
> maximum.
It's called max. A maximal element need not be unique even in
mathematics: <http://en.wikipedia.org/wiki/Maximal_element>.
More information about the Python-list
mailing list