[Zope] What use is BTrees ???

Thomas Guettler zopestoller@thomas-guettler.de
Fri, 03 May 2002 09:00:49 +0200


Max M wrote:

> I am unshure on how BTrees works, but I suspect that they might be 
> usefull in a project I am doing, so I thought I might ask here.
> 
> I have an object which hase a dict as an attribute, in which I store 
> other objects. I know this is a relative expensive way to do it as 
> everytime an object is added to the dict the full object will be stored 
> in the ZODB.
> 
> As far as I understand, the BTree is like a dict.
> 
> So do I understand it right that if I use a BTree as a attribute instead 
> of a dict, it will only store the elements that are added/changed in the 
> ZODB but otherwise act as a dict?
> 
> I use integers as keys in the dict


Be sure, that you only use objects which can be compared to each
other as keys. This means only use integers xor strings. Otherwise
you can't access the objects anymore because the internal sorting
gets confused. Unfortunately you don't get an exception if you
try to insert different keys.

   thomas