On Fri, 10 Jul 2009 09:22:29 -0400, Nikolaus Rath wrote: > Hello, > > I want to implement a caching data structure in Python that allows me > to: > > 1. Quickly look up objects using a key 2. Keep track of the order in > which the objects are accessed (most > recently and least recently accessed one, not a complete history) > 3. Quickly retrieve and remove the least recently accessed object.
Google for "python LRU cache". Here are the first three hits: http://code.activestate.com/recipes/498245/ http://code.activestate.com/recipes/252524/ http://www.algorithm.co.il/blogs/index.php/programming/python/small-python-challenge-no-2-lru-cache/ -- Steven -- http://mail.python.org/mailman/listinfo/python-list