kvesteri / intervals

Python tools for handling intervals (ranges of comparable objects).
BSD 3-Clause "New" or "Revised" License
107 stars 17 forks source link

Add union operator #11

Closed tvuotila closed 10 years ago

tvuotila commented 10 years ago

Add union operator so that Interval([1, 3]) | Interval([2, 4]) == IntInterval([1, 4])

kvesteri commented 10 years ago

Good job with this one too. If we want to do this in a more generic manner we need to add support for IntervalSets. IntervalSet would be an ordered set of intervals. Union would return an IntervalSet if the given intervals are discontinuous.