The REALLY bad thing about Python lists ..

Moshe Zadka moshez at math.huji.ac.il
Mon May 15 14:32:05 EDT 2000


On Mon, 15 May 2000, Russell Turpin wrote:

> Damn! From my tests, I was hoping that Python was smart,
> and it turns out, it is dumb, and the test was just
> "lucky."

In other words, Python optimizes for the common case (lists of <10,000
elements) pretty well. The test wasn't "lucky" -- it was "typical". You
can overallocate *2 space yourself inheriting from UserList, but this way
saves a lot of space when there are plenty of 100ish element lists about,
and has a much better LOR.

python-isn't-dumb-just-experienced-ly y'rs, Z.
--
Moshe Zadka <moshez at math.huji.ac.il>
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com





More information about the Python-list mailing list