dictionary that discards old items
Will McGugan
news at NOwillmcguganSPAM.com
Thu Jul 21 18:19:48 EDT 2005
Hi folks,
I need a collection class that behaves like a dictionary but when it
reaches 'n' items it discards the oldest item so that the length never
goes above 'n'. (Its for caching search results)
I have a vague memory of a module that does this, but I cant remember
where I read about it. Can anyone enlighten me?
Regards,
Will McGugan
--
http://www.willmcgugan.com
"".join({'*':'@','^':'.'}.get(c,0) or chr(97+(ord(c)-84)%26) for c in
"jvyy*jvyyzpthtna^pbz")
More information about the Python-list
mailing list