Giter VIP home page Giter VIP logo

Comments (4)

tseaver avatar tseaver commented on June 19, 2024 1

As long as all the keys are floats, you could use an OOBTree:

>>> from BTrees.OOBTree import OOBTree
>>> tree = OOBTree()
>>> 
>>> tree[.3] = 'wwww'
>>> tree[.4] = 'xxxx'
>>> tree[.5] = 'yyyy'
>>> tree[.6] = 'zzzz'
>>> list(tree.values(min=.35, max=.55))
['xxxx', 'yyyy']

from btrees.

jamadden avatar jamadden commented on June 19, 2024

BTrees are sorted by key, not value. The arguments to the values function allow you to get the subset of values whose keys are in the given range. Hence the arguments must be the type accepted for keys.

from btrees.

Kevin-Prichard avatar Kevin-Prichard commented on June 19, 2024

Okay, understood. Thanks for the swift response.

I suppose what I'm looking for, then, is a Btree implemented with float as the key type. So that I can perform inexact min/max range searches on floating point values.

Has anything like this been requested for BTrees? More importantly, do you believe it is possible?

from btrees.

Kevin-Prichard avatar Kevin-Prichard commented on June 19, 2024

That class I did not think of trying. Thanks very much, @tseaver, I will see how it works for me.

from btrees.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.