Serhiy Storchaka <[email protected]> added the comment:
Would be worth to add a wrapper in functools which revert the sorting order?
class reverted_order:
def __init__(self, value):
self.value = value
def __lt__(self, other):
if isinstance(other, reverted_order):
other = other.value
return self.value.__ge__(other)
# __le__, __gt__, __ge__, __eq__, __ne__, __hash__
Then you could use key=lambda x: (x['url'], reverted_order(x['user'])).
----------
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue35010>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com