reversed heapification?

Stefan Behnel stefan.behnel-n05pAM at web.de
Mon Mar 7 08:02:54 EST 2005


Kent Johnson wrote:
> heapq.nlargest()
> heapq.nsmallest()

On second thought, that doesn't actually get me very far. I do not know in 
advance how many I must select since I need to remove duplicates *after* 
sorting (they are not necessarily 'duplicate' enough to fall into the same 
sort bucket). What I'd like to do is heapify and then create an iterator for 
the result. But since heapify doesn't support "reverse" ...

Any other ideas?

Stefan



More information about the Python-list mailing list