[MERGE] FIFOCache and FIFOSizeCache

Robert Collins robertc at robertcollins.net
Tue Dec 9 22:40:17 GMT 2008


bb:tweak

fifo_cache and lru_cache module docstrings should reference each other I
think.


+        if key in self:
+            # Remove the earlier reference to this key, adding it again
bumps
+            # it to the end of the queue
+            del self[key]
+        self._queue.append(key)

might be better as:
try:
    # Remove the earlier reference to this key, adding it again bumps
    # it to the end of the queue
    del self[key]
except KeyError:
    pass
self._queue.append(key)

with the if key in self optimisation pushed down to __delitem__

-Rob

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 197 bytes
Desc: This is a digitally signed message part
Url : https://lists.ubuntu.com/archives/bazaar/attachments/20081210/c3751261/attachment.pgp 


More information about the bazaar mailing list