reversed heapification?

Jeff Epler jepler at unpythonic.net
Mon Mar 7 08:34:12 EST 2005


Can you use something like (untested)
    class ComparisonReverser:
        def __init__(self, s): self.s = s
        def __cmp__(self, o): return cmp(o, self.s)
        def __lt__...  # or whichever operation hashes use
then use (ComparisonReverser(f(x)), i, x) as the decorated item
instead of (f(x), i, x)

Jeff
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 196 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20050307/46b88699/attachment.sig>


More information about the Python-list mailing list