[ZODB-Dev] Weird KeyError with OOBTree

Hanno Schlichting hanno at hannosch.eu
Mon Aug 16 08:16:17 EDT 2010


On Mon, Aug 16, 2010 at 2:04 PM, Pedro Ferreira
<jose.pedro.ferreira at cern.ch> wrote:
> I think implementing a stable hash function for your type could make
> this work though.
>
> From what I read, ZODB doesn't use hash functions, relying on __cmp__
> instead. So, I guess I should make my class non-persistent and implement a
> __cmp__ function for it...

Right, implementing __cmp__ or all of the rich compare functions would
be best. The __hash__ is just used as the default backend for __cmp__
of object. It's probably better to not rely on that indirection and
implement compare directly.

Hanno


More information about the ZODB-Dev mailing list