Heap ordering in python