You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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)
The text was updated successfully, but these errors were encountered:
I'm sorry I didn't submit a PR for that. As I wanted interval arithmetic for Python asap, and as pyinter does not seem to be really maintained anymore, I created my own library (see https://github.com/AlexandreDecan/python-intervals).
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
Interval
objects also supportingIntervalSet
. In that case, an easy way could be to add:The text was updated successfully, but these errors were encountered: