The REALLY bad thing about Python lists ..

rturpin at rturpin at
Sun May 14 14:35:47 EDT 2000

rturpin at writes:
>> .. Creating vectors of length n by prepending
>> elements one at a time is now an n^2 operation!
In article <m33dnlowv4.fsf at>,
  Michael Hudson <mwh21 at> wrote:
> So create it by appending n elements and then
> reverse it..

Of course.  Unless you have an application that
manipulates both ends of the array!

> .. this is still n^2, I guess, ..

You guess wrong.  Creating an array by appending
at the end is linear in the length of the array.


Sent via
Before you buy.

More information about the Python-list mailing list