Matteo Dell'Amico <de...@linux.it> added the comment:
Personally, I'd find a maxheap in the standard library helpful, and a quick Google search tells me I'm not alone. I generally have to deal with numeric values, so I have these choices: - ugly code (e.g., `minus_distance, elem = heappop(heap)`, `distance = -minus_distance`) - slow code (e.g., wrapping heapq in a class) Since most of maxheap is already implemented in the library, I wonder what is the rationale for not including it. A couple of use cases for max-heap that I ran into: - maintaining k-nearest-neighbor structures (the farthest known one is at the top of the queue) - running median (requires both a minheap and a maxheap) ---------- nosy: +della _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue42240> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com