I'd like to represent an arbitrarily complex range of real values, which can be discontinuous, i.e.:
0--4 and 5--6 and 7.12423--8
Where I'll be adding new ranges incrementally:
(0--4 and 5--6 and 7.12423--8) | ( 2--7) = (0--7 and 7.12423--8)
I don't really know the right language to describe this, so I'm struggling to search, but it seems like a class probably already exists to do what I want to do. Does it?
There are at least a couple of packages listed in the Python Package Index which deal with intervals:
interval
pyinterval
I've experimented with interval
before and found it to be well-written and documented (at the moment its website seems to be unavailable). I've not used pyinterval
.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With