[ZODB-Dev] BTrees and PersistentDict keys: bug or feature
by Christian Reis other posts by this author
Aug 15 2003 1:01AM messages near this date
[ZODB-Dev] What are the ZopeDB limit?
|
RE: [ZODB-Dev] BTrees and PersistentDict keys: bug or feature
(I suppose I push these things in annoying ways.)
> >> x = OOBTree()
> >> x[{1:1, 2:2, 3:3}] = 1
> >> y = PersistentMapping({1:1, 2:2, 3:3})
> >> x[y]
Traceback (most recent call last):
File "<stdin> ", line 1, in ?
KeyError: {3: 3, 2: 2, 1: 1}
However,
> >> x[PersistentMapping({1:1, 2:2, 3:3})] = 0
> >> x[{1:1, 2:2, 3:3}]
1
Even more odd,
> >> y = PersistentMapping({1:1, 2:2, 3:3})
> >> x[y] = 1
> >> x[{1:1, 2:2, 3:3}]
1
> >> x[{1:1, 2:2, 3:3}] = 2
> >> x[y]
2
This strikes me as odd, and the fact that it does work perfectly for
PersistentList indicates it's a problem. The check() module indicates
it works okay.
I've tried to track this down but I'm not having a large measure of
success. It *seems* to me that the problem is PersistentMapping's
__cmp__ method is not being called consistently, but ever since Tim
warned me of mixed-type comparisons I've been reluctant to spend a long
time staring at code when I see these issues.
Should I just try and band-aid it in my code?
Take care,
--
Christian Reis, Senior Engineer, Async Open Source, Brazil.
http://async.com.br/~kiko/ | [+55 16] 261 2331 | NMFL
_______________________________________________
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/
ZODB-Dev mailing list - ZODB-Dev@[...].org
http://mail.zope.org/mailman/listinfo/zodb-dev
Thread:
Christian Reis
Tim Peters
Christian Reis
Casey Duncan
Christian Reis
Casey Duncan
Christian Reis
|