If the elements of mylist can be compared (es. not complex values),
then this can be a solution for you:

from math import sin as f
mylist = [float(2*i)/10 for i in xrange(10)]
pairs = [(f(x), x) for x in mylist]
ymax = max(pairs)[1]
print pairs, "\n"
print ymax

You can also try this, for Py2.4:
print max((f(x), x) for x in mylist)[1]

Bye,
bearophile

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

Reply via email to