Paul Rubin:
> def posmax(seq, key=lambda x:x):
>    return max(enumerate(seq), key=lambda k: key(k[1]))[0]

Is the Python max able to tell that's the identity function? I don't
think so, so your version may be slower and more memory hungry in the
common situation where you don't have a key function. So I think my
version is better :-)

Bye,
bearophile
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to