If i have a list and a function to calculate score, I could calculate argmax as such:
maxscore = 0; argmax = None
x = [3.49, 0.122, 293, 0.98] # Imagine a LARGE list.
for i in x:
# Maybe there're some other func() to calculate score
# For now just sum the digits in i.
score = sum([int(j) for j in str(i) if j.isdigit()])
print i, score
if maxscore < score:
maxscore = score
argmax = i
Is there any other way to achieve argmax? What is the pythonic way to do so?