I wish to hold a heap of objects, not just numbers. They will have an integer attribute in them that the heap can sort by. The easiest way to use heaps in python is heapq,
I feel the simplest way is to override the existing cmp_lt function of the heapq module. A short example:
import heapq # your custom function. Here, comparing tuples a and b based on their 2nd element def new_cmp_lt(self,a,b): return a[1]