[EMAIL PROTECTED] writes:
> def posmax(seq, key=None):
>     """Return the position of the first maximum item of a sequence.
>     It accepts the usual key parameter too."""
>     if key:
>         return max(enumerate(seq), key=lambda k: key(k[1]))[0]
>     else:
>         return max(enumerate(seq), key=itemgetter(1))[0]

def posmax(seq, key=lambda x:x):
   return max(enumerate(seq), key=lambda k: key(k[1]))[0]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to