Skip to content

Commit

Permalink
pythongh-107421: Clarify OrderedDict Examples and Recipes (python#1…
Browse files Browse the repository at this point in the history
  • Loading branch information
shailshouryya authored Aug 11, 2023
1 parent 50bbc56 commit 23a6db9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions Doc/library/collections.rst
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,7 @@ variants of :func:`functools.lru_cache`:
result = self.func(*args)
self.cache[args] = time(), result
if len(self.cache) > self.maxsize:
self.cache.popitem(0)
self.cache.popitem(last=False)
return result

Expand Down Expand Up @@ -1256,12 +1256,12 @@ variants of :func:`functools.lru_cache`:
if self.requests[args] <= self.cache_after:
self.requests.move_to_end(args)
if len(self.requests) > self.maxrequests:
self.requests.popitem(0)
self.requests.popitem(last=False)
else:
self.requests.pop(args, None)
self.cache[args] = result
if len(self.cache) > self.maxsize:
self.cache.popitem(0)
self.cache.popitem(last=False)
return result
.. doctest::
Expand Down

0 comments on commit 23a6db9

Please sign in to comment.