Algorithm help per favore

Erik Max Francis max at alcyone.com
Thu Jun 19 14:17:58 EDT 2003


Matt Shomphe wrote:

> I think this may be faster than calling enumerate() repeatedly.

Unlikely, since you're only calling enumerate once.  `for x in seq'
evaluates seq once and then iterates over it; it doesn't evaluate seq
each time through the loop.  Indeed, enumerate was introduced precisely
to obviate the need for indexing over lists of indices and mapping those
to the original sequence.

-- 
   Erik Max Francis && max at alcyone.com && http://www.alcyone.com/max/
 __ San Jose, CA, USA && 37 20 N 121 53 W && &tSftDotIotE
/  \ Wars may be fought with weapons, but they are won by men.
\__/  Gen. George S. Patton




More information about the Python-list mailing list