chaimleib / intervaltree

A mutable, self-balancing interval tree. Queries may be by point, by range overlap, or by range containment.
Apache License 2.0
636 stars 108 forks source link

unnecessary chopping #141

Open notestaff opened 2 months ago

notestaff commented 2 months ago

At https://github.com/chaimleib/intervaltree/blob/01a30a8df977a02e1b6e25eee3838b8d6b340995/intervaltree/intervaltree.py#L503

should this be end_hits = [iv for iv in self.at(end) if iv.begin < end]

? The end of the chopping interval is not part of the chopping interval, and an existing interval that starts at the end of the chopping interval does not need any part of it chopped off. Also, checking iv.end > end seems unnecessary since it should hold for any interval returned by self.at(end).