It would be nice to have a class such as:
class IntervalContainer:
def __init__(self):
self.intervals = []
def add(self, interval):
...
intervals = Intervals()
for interval in [(0, 1), (3, 4), (7, 8), (1, 5)]:
intervals.add(interval)
print(self.intervals)
# Output: [(0, 5), (7, 8)]
It would be nice to have a class such as: