Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

bintrees is discontinued in favor of sortedcontainers #947

Closed
afaerber opened this issue Apr 14, 2018 · 6 comments
Closed

bintrees is discontinued in favor of sortedcontainers #947

afaerber opened this issue Apr 14, 2018 · 6 comments
Labels
help wanted Good issue for community involvement project A large project. Will take some time

Comments

@afaerber
Copy link
Contributor

https://pypi.python.org/pypi/bintrees/2.0.7

Bintrees Development Stopped
Use sortedcontainers instead: https://pypi.python.org/pypi/sortedcontainers
see also PyCon 2016 presentation: https://www.youtube.com/watch?v=7z2Ki44Vs4E
Advantages:

  • pure Python no Cython/C dependencies
  • faster
  • active development
  • more & better testing/profiling
@zardus
Copy link
Member

zardus commented Apr 15, 2018

Unfortunately, sortedcontainers doesn't seem to be a viable replacement. What we need is:

import bintrees
x = bintrees.BinaryTree()
x[10] = 'ten'
assert x.floor_item(15) == (10, 'ten')
assert x.ceiling_item(5) == (10, 'ten')

Last time I looked (and from a quick look just now), sortedcontainers does not support this :-(

@afaerber
Copy link
Contributor Author

File an issue against sortedcontainers requesting that function?

@zardus
Copy link
Member

zardus commented Apr 16, 2018

Worth trying for sure. Thanks for the suggestion.

I opened up grantjenks/python-sortedcontainers#87.

@zardus zardus added project A large project. Will take some time help wanted Good issue for community involvement labels Apr 16, 2018
@zardus
Copy link
Member

zardus commented Apr 16, 2018

Looks like it's actually supported!

import sortedcontainers
s = sortedcontainers.SortedDict()
s[10] = 'ten'
s[3] = 'three'

# floor
assert next(s.irange(maximum=15, reverse=True)) == 10

# ceiling
assert next(s.irange(minimum=5, reverse=False)) == 10

# succimport sortedcontainers
s = sortedcontainers.SortedDict()
s[10] = 'ten'
s[3] = 'three'

# floor
assert next(s.irange(maximum=15, reverse=True)) == 10

# ceiling
assert next(s.irange(minimum=5, reverse=False)) == 10

# succ
assert next(s.irange(minimum=3, inclusive=(False, False), reverse=False)) == 10

# prev
assert next(s.irange(maximum=10, inclusive=(False, False), reverse=True)) == 3
assert next(s.irange(minimum=3, inclusive=(False, False), reverse=False)) == 10

# prev
assert next(s.irange(maximum=10, inclusive=(False, False), reverse=True)) == 3

Marking this as a "help wanted" pending someone having the time to switch this over :-)

@ltfish
Copy link
Member

ltfish commented Apr 16, 2018

I really like bintrees :( Too bad that it's discontinued.

@ltfish
Copy link
Member

ltfish commented Apr 24, 2018

Addressed by PR #962. Close.

@ltfish ltfish closed this as completed Apr 24, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Good issue for community involvement project A large project. Will take some time
Projects
None yet
Development

No branches or pull requests

3 participants