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]



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

Dmitry Vasiliev (dima at hlabs.spb.ru)
For more information about ZODB, see the ZODB Wiki:

ZODB-Dev mailing list  -  ZODB-Dev@zope.org

Reply via email to