"Terry Reedy" <[EMAIL PROTECTED]> writes:
> | > What's about l.index(max(l)) ?
> 
> Both of these methods scan the list twice.  The two given by RH and SDD do 
> so just once.  Both of those will give the index of the of the last maximum 
> value.  If you want the index of the first max value (you did not specify 
> ;-), write an explicit loop. 

How about (corrected but still untested):

  -max((v,-i) for i,v in enumerate(l))[1]

I may have still missed something.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to