[ZODB-Dev] BTrees questions
Jim Fulton
jim@zope.com
Mon, 17 Dec 2001 18:14:34 -0500
Martijn Faassen wrote:
>
> Hi there,
>
> I've been experimenting some with buckets & btrees some,
> but am a bit confused about some issues. Example first:
>
> >>> from BTrees.IIBTree import IIBucket
> >>> b = IIBucket([(1, 4), (2, 5), (3, 6)])
> >>> b
> IIBucket([(1, 4), (2, 5), (3, 6)])
> >>> b.keys(0, 4)
> [1, 2, 3]
> >>> b.values(0, 4)
> [4, 5, 6]
> >>> b.keys(2, 3)
> Traceback (most recent call last):
> File "<stdin>", line 1, in ?
> IndexError: list assignment index out of range
>
> Should this happen?
No. This is a bug. Dang. Would you mind submitting a
collector issue on this?
> It seems to happen for buckets whenever I fill in
> a min larger than 1. I probably don't understand the datastructure
> too well but I thought I'd ask. Should I be using buckets or BTrees?
I can't say, since I don't know what you want to do with them.
Buckets are best for small amounts of data or when you want to
force data into one data structure or database record.
If you aren't sure, use BTrees. :)
Jim
--
Jim Fulton mailto:jim@zope.com Python Powered!
CTO (888) 344-4332 http://www.python.org
Zope Corporation http://www.zope.com http://www.zope.org