[MERGE] FIFOCache and FIFOSizeCache

Robert Collins robertc at robertcollins.net
Tue Dec 9 23:14:32 GMT 2008


On Tue, 2008-12-09 at 16:54 -0600, John Arbash Meinel wrote:
> 
> That would optimize for the case where you are replacing items, rather
> than optimizing for the case where add is called when the item is not
> present.

Well, I wasn't trying to change the optimisation at all.

> It is hard to say what the most common case is, but I would guess that
> most caches are only used for things that won't actually mutate, so I
> would rather optimize for that case.
> 
> Or are you just trying to change the semantics of "del fifo[foo]" into
> "fifo.discard(foo)" [which doesn't raise if foo doesn't exist]?

if moved into __delitem__ I was expecting

if key not in self:
    raise KeyError(key)
...

> I'm willing to change it, but I think I have it written the correct
> way.

It just seems duplicative.

-Rob

-- 
GPG key available at: <http://www.robertcollins.net/keys.txt>.
-------------- 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/76a860b6/attachment.pgp 


More information about the bazaar mailing list