John Machin
1/21/2008 9:47:00 PM
On Jan 22, 7:56 am, Paul Rubin <http://phr...@NOSPAM.invalid> wrote:
> John Machin <sjmac...@lexicon.net> writes:
> > s/[1]/[0]/ or more generally:
>
> Oops, got two spellings confused. Originally was going to use
>
> from itertools import count, izip
> min(izip(seq, count()))[1]
>
> but did it with enumerate instead. I don't know which is actually
> faster.
>
> > minindex, minvalue = min(enumerate(seq), key=itemgetter(1))
>
> Cool, I like this best of all. Or alternatively,
>
> minindex, minvalue = min(izip(seq, count()))
Bzzzt #2!
>>> from itertools import count, izip
>>> min(izip(seq, count()))
(7, 3)