[ZODB-Dev] BTrees Bug?
Chris Withers
chris at simplistix.co.uk
Wed Feb 2 09:59:37 EST 2005
Hi,
I finally got to the bottom of a long standing nasty little bug, which,
in short form, looks like this:
>>> from BTrees.IOBTree import IOBTree
>>> b = IOBTree()
>>> b[0]=();b[1]=(1,);b[2]=(2,);b[3]=(3,);b[4]=(4,);b[5]=(5,);b[6]=(6,);
>>> for key in b.keys(0,3):
... print key
... del b[key]
...
0
2
4
6
Now, I can see why that happens, once I finally realised what was going
on, but I have a coupla questions:
1. What's a better way of doing this? ie: processing a section of a
btree which may involve deleting some keys? (this behaviour also applies
to .values(0,x) and .items(0,x))
2. The above feels like a bug to me, even excluding the common pythonism
of not being able to iterate over mutables if you're changing them. The
above code is saying "gimme keys where the key is less that 3", which it
doesn't do :-S
What do other people feel about this?
Chris
--
Simplistix - Content Management, Zope & Python Consulting
- http://www.simplistix.co.uk
More information about the ZODB-Dev
mailing list