[Python-Dev] PEP 372 -- Adding an ordered directory to collections ready for pronouncement

Raymond Hettinger python at rcn.com
Tue Mar 3 21:02:14 CET 2009


[Forest]
> Okay, but I'd also like a convenient and fast way to find the oldest entry
> in an OrderedDict, which I think I'd need for an LRU cache.  Skimming the
> current patch (od7.diff), I didn't notice one.  Perhaps I simply missed
> something.  Shouldn't popitem() allow the caller to choose which end from
> which to pop?

Forest, I've taken another look at what's involved and am inclined to recommend the idea.  It can be done without mucking-up the 
regular dict API and without precluding any of the other possible underlying algorithms.  I like that it supports an entire new 
categoy of use cases with only a trivial, easily-understood API extension.  Patch is attached at http://bugs.python.org/issue5397


Raymond 



More information about the Python-Dev mailing list