maximum element?
Heather Coppersmith
me at privacy.net
Thu Mar 4 16:12:48 EST 2004
On Thu, 04 Mar 2004 21:52:50 +0100,
Ivan Voras <ivoras at __geri.cc.fer.hr> wrote:
> What is the 'most pythonic' way of searching the largest element in a
> list/tuple?
> My 'standard' idea is:
> max = list[0] # 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... :)
How about max( list )?
Regards,
Heather
--
Heather Coppersmith
That's not right; that's not even wrong. -- Wolfgang Pauli
More information about the Python-list
mailing list