David Isaac aisaac0 at
Thu Jun 1 16:07:15 CEST 2006

1. Why is there no argmax built-in?
(This would return the index of the largest element in a sequence.)

2. Is this a good argmax (as long as I know the iterable is finite)?
def argmax(iterable): return max(izip( iterable, count() ))[1]

3. If this is the only place in a module where I need count and izip,
should I import them at the module level or at the level of the function?
What are the considerations here?

Alan Isaac

More information about the Python-list mailing list