How should argmax be implemented in Python? It should be as efficient as possible, so it should work with iterables.
Three ways it could be implemented:
- given an iterable of pairs return the key corresponding to the greatest value
- given an iterable of values return the index of the greatest value
- given an iterable of keys and a function
f
, return the key with largestf(key)