[ZODB-Dev] [BTrees] Inconsistent equality checks
Dieter Maurer
dieter at handshake.de
Fri Nov 7 14:28:48 EST 2003
Tim Peters wrote at 2003-11-6 16:38 -0500:
> ...
> > Looking for an alternative, I met the following inconsitency:
> >
> > a= OOSet((1,2,3))
> > b= OOSet((1,2,3))
> > a.keys() == b.keys()
> > --> 1
> >
> > a= OOTreeSet((1,2,3))
> > b= OOTreeSet((1,2,3))
> > a.keys() == b.keys()
> > --> 0
> >
> > We have the same inconsistency for "OOBucket", "OOBTree" and
> > "items".
>
> The result type of keys() has to implement IReadSequence, but the
> IReadSequence interface doesn't define anything about comparability. What
> you've determined here is that a Python list (returned by Bucket and Set
> keys/items/values) implements a different notion of comparison than does a
> BTreeItems object (returned by BTree and TreeSet keys/items/values).
That's a nice implementation centric explanation of what I found out.
However, from a semantics point of view "OOSet" and "OOTreeSet"
are two implementations of the same abstract data type.
It is therefore surprising that their "keys()" result behave
semantically different with respect to "==".
--
Dieter
More information about the ZODB-Dev
mailing list