From: Scott Gasch Date: Fri, 16 Dec 2022 00:26:54 +0000 (-0800) Subject: Tiebreak ordering of ranges with the same lower bound using upper bound. X-Git-Url: https://wannabe.guru.org/gitweb/?a=commitdiff_plain;h=5fd1f68a58ef3bbf37528b9397a6950d7af661ab;p=pyutils.git Tiebreak ordering of ranges with the same lower bound using upper bound. --- diff --git a/src/pyutils/collectionz/interval_tree.py b/src/pyutils/collectionz/interval_tree.py index 7ba190a..a8278a2 100644 --- a/src/pyutils/collectionz/interval_tree.py +++ b/src/pyutils/collectionz/interval_tree.py @@ -47,7 +47,10 @@ class NumericRange(object): Returns: True is this range is less than (lower low) other, else False. """ - return self.low < other.low + if self.low != other.low: + return self.low < other.low + else: + return self.high < other.high @overrides def __eq__(self, other: object) -> bool: