[Chris S]
Is there a way to determine the nearest neighbors to a key in an
OOBTree? Something like:

>>> from BTrees.OOBTree import OOBTree
>>> tree = OOBTree(dict(a=1, b=2, c=3, d=4))
>>> tree.nearestLowItem('b')
('a',1)
>>> tree.nearestHighItem('b')
('c',3)

Efficient range searches are an important feature of BTrees.  See
BTrees/Interfaces.py, and especially the optional arguments to:

   IKeyed.keys()
   IKeyed.maxKey()
   IKeyed.minKey()

   IMinimalDictionary.values()
   IMinimalDictionary.items()
_______________________________________________
For more information about ZODB, see the ZODB Wiki:
http://www.zope.org/Wikis/ZODB/

ZODB-Dev mailing list  -  ZODB-Dev@zope.org
http://mail.zope.org/mailman/listinfo/zodb-dev

Reply via email to