kvesteri / intervals

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

Intersect returns empty intervals e.g. (5, 5] which are unusable. #43

Open IlianIliev opened 6 years ago

IlianIliev commented 6 years ago

The current code allows the creation of an intervals where the borders are touching, which makes them unusable:

>>> 5 in IntInterval.from_string('[5, 5)')
False

In addition this leads to the fact that the intersection of touching intervals is such an "empty" interval:

>>> FloatInterval.from_string('[0, 5]') & FloatInterval.from_string('(5, 15]')
FloatInterval('(5.0, 5.0]')
IlianIliev commented 6 years ago

In addition how about IntIntervals where the boundaries are not far enough e.g. IntInterval.from_string('(2, 3)')