maximum element?

Ivan Voras ivoras at __geri.cc.fer.hr
Thu Mar 4 21:52:50 CET 2004


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... :)




More information about the Python-list mailing list