get-a-cup-of-coffee slow

Courageous jkraska1 at san.rr.com
Sat Aug 11 13:10:10 EDT 2001


>So...I would try using an array to start with. But,if you find a list is 
>faster (which I'd find a bit surprising ....

Python lists are tail-preallocated vectors. Therefore, adding to the
end of a list occurs in (close to*) amortized constant time.

(*) note that while this statement isn't strictly true, it's as true as it
needs to be. :)

C//




More information about the Python-list mailing list