I have a file with defines a class X, and inside that class there is a definition for def __lt__(self, other):.
class X
def __lt__(self, other):
In another file, I have a heapq of X's. However, this pq needs to compare X's differently than what is defined in __lt__.
X
__lt__
Is there a way for me to overide the __lt__ for X's in this file? Or is there a better way for me to use a custom comparator for the heapq?
1.4m articles
1.4m replys
5 comments
57.0k users