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
See https://github.com/axiak/py-rangeset <https://github.com/axiak/py-rangeset>__
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.14.linux-x86_64.tar.gz
Algorithm | Hash digest | |
---|---|---|
SHA256 | a3e304d8446c76621c2c293717bd68536e1c430bd8d55af037541db604f9f8a8 |
|
MD5 | b25dddc0a599b793459018912aed72c1 |
|
BLAKE2b-256 | c86ea8c39bffcf4948e611bf0aeccb801185165f4b6409d96a538257cfa5ad89 |