Right now, it's not possible to write closed(3,4) | closed(5,6) | closed(4,5). It results in a TypeError saying that Interval object is not iterable.
The current workaround is to wrap the Interval object into a IntervalSet, e.g. closed(3,4) | closed(5,6) | IntervalSet([closed(4,5)]) which is not very convenient.
A simple way to support the first notation could be to add:
other = IntervalSet([other]) if isinstance(other, Interval) else other
It could actually be a good idea to have Interval objects also supporting IntervalSet. In that case, an easy way could be to add:
if isinstance(other, IntervalSet):
return other.union(self)
Right now, it's not possible to write
closed(3,4) | closed(5,6) | closed(4,5). It results in a TypeError saying that Interval object is not iterable.The current workaround is to wrap the Interval object into a IntervalSet, e.g.
closed(3,4) | closed(5,6) | IntervalSet([closed(4,5)])which is not very convenient.A simple way to support the first notation could be to add:
It could actually be a good idea to have
Intervalobjects also supportingIntervalSet. In that case, an easy way could be to add: