thorsten at thorstenkampe.de
Thu Apr 29 00:55:29 CEST 2004
* Ivan Voras (2004-03-04 22:52 +0100)
> What is the 'most pythonic' way of searching the largest element in a
> My 'standard' idea is:
> max = list # or -infinity, or whatever...
> for i in list:
> if i > max:
> max = i
> While this is ok, I somehow 'feel' there could be a more concise
> solution... :)
In a real world example you wouldn't be interested in "the" maximum
but in the extrema/maxima according to function f (in your case the
identity f(x)=x), which could be more than just one item.
More information about the Python-list