[ZODB-Dev] OOBTree: Persistent Objects as keys

Toby Dickenson tdickenson@geminidataloggers.com
Tue, 5 Feb 2002 13:57:55 +0000


On Tuesday 05 February 2002 1:56 pm, Thomas Guettler wrote:
>Toby Dickenson wrote:
>>On Tue, 05 Feb 2002 10:46:52 +0100, Thomas Guettler
>>
>><zopestoller@thomas-guettler.de> wrote:
>>> I have a strange problem with persistent objects as keys
>>>The __hash__ function of my class:
>>
>>Are you sure its getting called? by the BTree?
>>
>>BTrees store keys using their sort order, not hash value. I guess you
>>have not defined a __cmp__ ?
>
>Thank you Toby. Unfortunately I have different types of objects as keys.
>I think this won't be
>that easy. I think it is not that easy to compare strings and different
>kind of objects with each other.

Indeed.

You are not alone with this proble; Zope makes the same mistake since it uses 
keys of different types in ZCatalog Indexes. The symptom of the problem, as 
you describe, is keys myseriously disappearing.

Im not aware of any good solution.

:-(