Skip to main content

Efficient storage for sets of mostly-consecutive integers

Project description

License: Your choice of MIT or Apache License 2.0

Rationale

Python Sets are nice to work with, but very inefficient if you need a large set with mostly-consecutive integers. The RangeSet class provides efficient handling and storage for these sets.

Non-integers?

RangeSet works with any class whose instances are

  • comparable

  • step-able, i.e. you can add 1 to them / subtract 1 from them.

  • discrete, i.e. there is no value between n and n+1.

RangeSet doesn’t add or subtract any other values, nor does it try to subtract two instances from each other.

The requirement to subtract 1 is an optimization that could be removed if necessary.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

range_set-0.3.2.tar.gz (23.9 kB view hashes)

Uploaded Source

Built Distribution

range_set-0.3.2-py3-none-any.whl (10.2 kB view hashes)

Uploaded Python 3

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page