Add method to OrderedDict for repositioning keys to the ends.

This commit is contained in:
Raymond Hettinger 2010-09-06 21:26:09 +00:00
parent 7b2a7710ef
commit f45abc97bf
5 changed files with 51 additions and 8 deletions

View file

@ -127,7 +127,7 @@ def lru_cache(maxsize=100):
len=len, KeyError=KeyError):
cache = OrderedDict() # ordered least recent to most recent
cache_popitem = cache.popitem
cache_renew = cache._renew
cache_renew = cache.move_to_end
kwd_mark = object() # separate positional and keyword args
lock = Lock()