The REALLY bad thing about Python lists ..

Gordon McMillan gmcm at hypernet.com
Mon May 15 20:11:41 CEST 2000


rturpin at my-deja.com <rturpin at my-deja.com> wrote:

[list allocation strategy]


>.... I suspect, though, that Python is smart,
>and doubles the length of the array each time it exceeds
>its current allocation. In this case, the cost of copies
>is O(n). Since my empirical runs show O(n) behavior, I
>would bet money that Python is smart about this.

You lose!

Please send me a blank check...

(It's *nix allocation that is smart about this - it screws up royally on 
Windows, though only for really big lists).

- Gordon




More information about the Python-list mailing list