Steven Bethard wrote:
> Can you do something like::
> 
>      max_val, max_index = max((x, i) for i, x in enumerate(my_list))
> 
> ?  If any two "x" values are equal, this will return the one with the 
> lower index.  Don't know if that matters to you.

Wouldn't it return the one with the highest index?

-- 
Robert Kern

"I have come to believe that the whole world is an enigma, a harmless enigma
 that is made terrible by our own mad attempt to interpret it as though it had
 an underlying truth."
  -- Umberto Eco

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to