diff options
Diffstat (limited to 'pylru.py')
-rw-r--r-- | pylru.py | 5 |
1 files changed, 3 insertions, 2 deletions
@@ -43,7 +43,8 @@ class lrucache(object): def __init__(self, size, callback=None): self.callback = callback - # Initialize the hash table as empty. + + # Create an empty hash table. self.table = {} # Initialize the doubly linked list with one empty node. This is an @@ -233,7 +234,7 @@ class lrucache(object): # Decreases the size of the list by removing n nodes from the tail of the # list. def removeTailNode(self, n): - assert self.listSize > 1 # Invarient. XXX REMOVE this line XXX + assert self.listSize > n for i in range(n): node = self.head.prev if not node.empty: |