kent37 at tds.net
Mon Mar 7 15:00:06 CET 2005
Stefan Behnel wrote:
> Kent Johnson wrote:
> 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?
Wrap your data in a class that defines __cmp__ as the inverse of __cmp__ on the underlying data,
then use heapq?
Just sort the list?
More information about the Python-list