Iteration over Lists and Strings

Marc 'BlackJack' Rintsch bj_666 at gmx.net
Sat Aug 28 15:24:17 EDT 2004


In <5M4Yc.326126$a24.276550 at attbi_s03>, Brent W. Hughes wrote:

> Did you say enumerate(seq) takes constant time?  I would have thought it was
> proportional to len(seq).

>>> seq = [1,2,3]
>>> enumerate(seq)
<enumerate object at 0x4039dcec>

I guess creating a enumerate object (generator) takes constant time.  ;-)

Ciao,
	Marc 'BlackJack' Rintsch



More information about the Python-list mailing list