E. Mark Ping
emarkp at CSUA.Berkeley.EDU
Fri Jun 1 21:13:24 CEST 2001
In article <mailman.991336497.10877.python-list at python.org>,
D-Man <dsh8290 at rit.edu> wrote:
>Yes, but I think
>s = ('a', 'b', 'ala', 'a')
>for i in xrange( len( s ) ) :
> print i , s[i]
>is easier to read, and you don't have the chance of forgetting to
>increment the counter.
Agreed. But does it introduce n^2 complexity? I can't find anything
in the python docs that says that indexing into a list is O(1)--and
most people assume that indexing into a list is O(n).
emarkp at soda.CSUA.Berkeley.EDU
More information about the Python-list