[ZODB-Dev] BTrees and setdefault
Dmitry Vasiliev
lists at hlabs.spb.ru
Mon Aug 29 08:13:37 EDT 2005
Tim Peters wrote:
> [Ruslan Spivak]
>
>>>I'd like to implement 'setdefault' method for BTrees. For me it seems
>>>like lacking feature of mapping protocol. It can be of course easily
>>>emulated, but "Readability counts."(C) :)
>>>
>>>If there won't be objections regarding this method then i'll try to make
>>>this excercise on the branch.
>
>
> [Dmitry Vasiliev]
>
>>See:
>>
>>http://mail.zope.org/pipermail/zodb-dev/2004-September/008034.html
>>http://mail.zope.org/pipermail/zodb-dev/2004-October/008040.html
>
>
> Dmitry, it's nearly a year since you first suggested this. Have you missed
> these methods in practice (i.e., do you have use cases), or it still just a
> matter of making BTrees formally "more like" newer Python dictionaries?
Since then I've changed my mind and almost haven't used setdefault(). So now
I'm only +0 on the idea. :-) I think pop() is even more useful than
setdefault(), I've planned to use it for some persistent queue implementation
(based on BTrees). So if setdefault() will be added I think it would be also
useful to add the pop() method.
> Ruslan, don't forget to change BTrees/Interfaces.py. I find that hard to
> follow: defining 14 interfaces to describe the BTree types makes it quite a
> maze to traverse. If setdefault() is added, it probably belongs in
> IDictionaryIsh.
--
Dmitry Vasiliev (dima at hlabs.spb.ru)
http://hlabs.spb.ru
More information about the ZODB-Dev
mailing list