[ZODB-Dev] RE: B-Tree API - again!

Magnus Lycka magnus@thinkware.se
Fri, 06 Dec 2002 17:55:28 +0100


At 11:16 2002-12-06 -0500, Jeremy Hylton wrote:
>It would be misleading to add a sort() method to the BTreesItems
>class.

I can agree with that, and my suggestion would be
to go through the work of removing the redundant
.sort() methods. Assuming an extensive unit test
suit they should be trivial to find! ;) I think it's
really bad from a maintenance point of view to have
redundant and completely meaningless method calls
in the code. On the other hand I imagine situations
where I'd want to make classes more "polymorph"...

I still think it's very strange that this doesn't
work though:

 >>> class x(BTrees.OOBTree.OOBTree):
...     pass
...
 >>> a = x()
 >>> a[1] = 1
 >>> del a[1]
Traceback (most recent call last):
   File "<interactive input>", line 1, in ?
AttributeError: __delitem__

Is there are a good explanation for this?

Why is it that OOBTree doesn't have a __delitem__
but "del tree[x]" still works!


-- 
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/  mailto:magnus@thinkware.se