Comments (4)
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.
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.
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.
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)
- Python 2: OxBTrees allow types as keys; Python 3 does not
- Can we move to the src/ layout? HOT 3
- Support PURE_PYTHON=0 to require C extensions
- BTree.get() swallows POSKeyError on internal corruption (C only) HOT 2
- Python/C Inconsistency: Detecting classes that just implement `__eq__`
- Python/C Inconsistency: Getting/Setting max_internal_size on the BTree class
- Regression in 4.9: Subclasses can't use @adapter
- fsBTree and fsTreeSet broken in 4.9.0/4.9.1
- fsBTree.difference fails when the second argument is a set HOT 2
- Zope5.2.1 install warnings HOT 3
- Convert to meta/config HOT 2
- Consider using cibuldwheel for building binary wheels. HOT 1
- 4.10.0: sphinx warnings `reference target not found` HOT 3
- 4.10.0: pytest is failing in some units HOT 6
- btrees not installing on m1 computer HOT 2
- Get a random element from a BTree HOT 2
- 'IFBucket' object has no attribute 'byValue' when running with PURE_PYTHON HOT 1
- Length Object not working from outside tree class HOT 4
- 5.2: pytest fails in 24 units with pytest 8.2.1 (mostly with `AssertionError: TypeError not raised`) HOT 9
- Move global statics to module state
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from btrees.