How is max supposed to work, especially key.
Peter Otten
__peter__ at web.de
Thu Dec 4 06:31:00 EST 2014
Albert van der Horst wrote:
> 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.
But a maximum is often ambiguous. What is max(people), the oldest, tallest,
or richest person? The key argument is a convenient way to disambiguate.
More information about the Python-list
mailing list