On 18 July 2011 13:08, Pedro Ferreira <jose.pedro.ferre...@cern.ch> wrote:
>> TreeSets are essentially BTrees with only keys. This means that the
>> members of a TreeSet must have a stable ordering. I suspect that that
>> c's class does not define the comparison methods (such as __lt__)
>> which means under Python 2 it falls back to the default ordering based
>> on object id (Python 3 will raise a TypeError instead, avoiding this
>> problem.) With ZODB an object's Python id (the memory address of the
>> object) will change whenever it is reloaded, i.e. across restarts,
>> after invalidation or removal from the cache.
> Yes, I know that. But I have a __cmp__ function defined, based on an
> object property that never changes. That should be enough, no?

I think it should, but are you absolutely certain it never changes?
Does list(s) == sorted(list(s)) and does list(s) ==

For more information about ZODB, see the ZODB Wiki:

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

Reply via email to