Hi!
I need a general-purpose best-k sorting algorithm and I'd like to use heapq
for that (heapify + heappop*k). The problem is that heapify and heappop do not
support the "reverse" keyword as known from sorted() and list.sort(). While
the decorate-sort-undecorate pattern allows me to replace the "key" option, I
do not see an obvious way to have heapq work in a reverse way without making
assumptions on the data.
Any ideas?
Stefan