LRU cache (and other things missing from the standard library ...)

Gerhard Haering gh at ghaering.de
Mon Nov 1 13:47:58 EST 2004


I recently implemented a LRU cache. And I wondered why such a useful class is
not already in the standard library. The only thing I found was a cookbook
entry but the comments said it was problematic.

Btw. my implementation is currently at
http://initd.org/svn/initd/pysqlite/trunk/misc/lru.py Does anybody see any
problems with this code?

I've already started translating it into C (*) , which speeds it up by between
factor 5 to 8. Maybe a candidate for the standard library once it's finished?

-- Gerhard

(*) http://initd.org/svn/initd/pysqlite/trunk/src/cache.c is the first iteration.
-- 
A: Because it messes up the order in which people normally read text.
Q: Why is top-posting such a bad thing?
A: Top-posting.
Q: What is the most annoying thing on usenet and in e-mail?
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 196 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20041101/4407eb44/attachment.sig>


More information about the Python-list mailing list