[ZODB-Dev] Default comparison considered harmful in BTrees.

David Glick davidglick at groundwire.org
Mon Oct 25 17:58:37 EDT 2010


On 10/25/10 10:51 PM, Jim Fulton wrote:
> I'm inclined to treat the use of the comparison operator inherited
> from object in BTrees to be a bug.  I plan to fix this on the
> trunk.
>
> I'm tempted to fix this in 10.1.  This change would make it impossible
> to add keys to BTrees or buckets or to add items to BTree-based
> sets if the key or items inherits it's comparison from object.  This
> would only apply to instances of new-style classes, including
> persistent objects. (It wouldn't affect old-style-class instances,
> which are too hard to introspect.)
>
> Thoughts?
The motivation here is that the comparison inherited from object
compares the objects' memory locations, which is not stable beyond
deactivation for persistent objects, and therefore not suitable for use
as a BTree key. Correct? Preventing people from making that mistake
sounds like a good thing to me.
----------		
David Glick
 Web Developer
 davidglick at groundwire.org
 206.286.1235x32

Groundwire: You Are Connected		
 http://groundwire.org		

Online tools and stratgies for the environmental movement.  Sign up for Groundwire News!
 http://groundwire.org/email-capture


More information about the ZODB-Dev mailing list