On Tue, Mar 29, 2011 at 5:06 PM, MRAB <pyt...@mrabarnett.plus.com> wrote:
> I think I've found a solution:
>
>    class NegStr:
>        def __init__(self, value):
>            self._value = value
>        def __lt__(self, other):
>            return self._value > other._value

IOW:

cmp_to_key(lambda x, y: -cmp(x, y))

This is still just taking a cmp function and dressing it up as a key.
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to