[ZODB-Dev] BTree ranges

John Belmonte jvb at prairienet.org
Mon Oct 6 11:22:40 EDT 2003


Tim Peters wrote:
> I doubt anyone here uses BTrees indexed by floats.

I use BTrees indexed by floats.  It's for a job scheduler, where keys 
are floating point seconds since the epoch.  (Actually, to deal with two 
jobs scheduled for the same instant, they keys are a (time, id) tuple.)

> Your point is well taken but futile as given:  it would break far too much
> code to change this.
> 
> However, in ZODB4 the relevant BTree methods have grown optional exclude_min
> and exclude_max Boolean arguments.  There, e.g.,
> 
>     tree.items(10.0, 20.0, exclude_max=True)
> 
> does what you want.  Since that's a new feature, it can't be added to the
> 3.1 or even 3.2 versions of ZODB.  It may get backported to a 3.3 version of
> ZODB (if such a thing ever exists).

That's fine for the moment, and it reduces the complexity of wrapping 
the interfaces to do the right thing, but I would like to see a long 
term plan to fix this design misstep.  For example, make everyone aware 
that in ZODB 5.0 exclude_max will default to false, and in ZODB 6.0 
exclude_max will be removed.  At least our great-grandchildren can have 
a sane interface.


-- 
http:// if   le.o  /




More information about the ZODB-Dev mailing list