A data structure for dealing with sets of ranges.
Project description
Overview
Rangeset is a package that allows for easy manipulation of sets of ranges. These ranges can contain any ordered elements, be they numbers, tuples, or even datetime objects.
Installation
Use either:
python setup.py install
or:
pip install rangeset
Documentation
Basic Usage
import rangeset
# Create a rangeset
>>> r = RangeSet(1, 3) | (5, 6)
# negate
>>> (~r) & (0, 10)
<RangeSet 0 -- 1, 3 -- 5, 6 -- 10>
# "measure" - How much distance is in the ranges, minus the gaps
>>> ((~r) & (0, 10)).measure()
7
# range - Total distance between start and end
>>> ((~r) & (0, 10)).range()
10
For more usage examples, see the doctests at https://github.com/axiak/py-rangeset/tree/master/python2/rangeset/test
License
It’s licensed under the MIT License. Please see the license file for more: https://github.com/axiak/py-rangeset/blob/master/LICENSE
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Close
Hashes for rangeset-0.0.13.linux-x86_64.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | ef466b2c940fae704c9c8a76787de7709b70995e70a6598d31f9d472dd779c57 |
|
MD5 | 4c7004c940e4119b96e88f39f9f76480 |
|
BLAKE2b-256 | c83b9f95e5c9eaa59acb68712836c9ff484c8c5701fe16f68bc156b85c9ce941 |