On Fri, Sep 24, 2010 at 11:09:58AM -0400, Jim Fulton wrote: > I wasn't proposing to change anything. :) Breaking inheritance to avoid > inheriting a bad cmp seems rather too tricky. (I assume there isn't > a default comparison in Python 3, although I haven't checked.) > > I suppose that the BTree implementation could check for object's > bad comparison operator and fail if it sees it. (Details omitted. :) > > This obviously wouldn't happen in 3.10, but might be a fun project for > someone in 3.11.
What would you think of adding def __lt__(self, other): if not isinstance(other, Persistent): raise ValueError('cannot compare Persistent with %s' % repr(other)) if self._p_oid is None or other._p_oid is None: raise ValueError('cannot compare objects that have no persistent IDs yet; call connection.add()') return self._p_oid < other._p_oid # define __le__, __gt__, __ge__ in a similar way to persistent.Persistent? Marius Gedminas -- The old political syllogism "something must be done: this is something: therefore this will be done" appears to be at work here, in spades.
Description: Digital signature
_______________________________________________ For more information about ZODB, see the ZODB Wiki: http://www.zope.org/Wikis/ZODB/ ZODB-Dev mailing list - ZODB-Dev@zope.org https://mail.zope.org/mailman/listinfo/zodb-dev