[ZODB-Dev] BTree sets and unhashable objects

Roché Compaan roche at upfrontsystems.co.za
Wed Jun 18 20:02:59 EDT 2003


* Tim Peters <tim at zope.com> [2003-06-18 18:55]:
> [Roché Compaan]
> > I was using OOSet for set operations on sequences of objects in the
> > ZODB and was getting horrably incorrect results. After I reread the
> > Btrees Wiki I noticed that the objects should be hashable,
> 
> I don't know which Wiki that refers to (have a URL handy?), but it's wrong:
> BTree operations (which include OOSets) never ask for an object's hash code
> (Python dicts do, BTrees do not).

http://www.zope.org/Members/ajung/BTrees/DataTypes

Actually it doesn't say that sets can only work with hashable objects -
I assumed that this was the problem because the wiki does say that
OOBTrees maps hashable objects to hashable objects.

> 
> > which they weren't of course. Maybe the set classes can be so nice
> > as to not accept unhashable objects in the first place and stop
> > stupidly forging ahead in its tracks ;-)
> 
> The problem is due to something else.  

So this might be a bug?

> The "real rules" for BTrees are here:
> 
>     http://www.zope.org/Wikis/ZODB/guide/node6.html
> 
> esp. section 5.3.1, "Total Ordering and Persistence".

I'll have a look tonight to see if I meet all the criteria - if I do
then I will send some more info to determine if I've hit a bug or not.

-- 
Roché Compaan
Upfront Systems                 http://www.upfrontsystems.co.za



More information about the ZODB-Dev mailing list