Hi, On Sat, 30 Oct 2021 at 16:23, Raymond Bisdorff <raymond.bisdo...@pt.lu> wrote:
> >>> L = [(1, 'a'), (2, 'b'), (1, 'c'), (2, 'd'), (3, 'e')] > >>> L.sort(reverse=True) > >>> L > >>> [(3, 'e'), (2, 'd'), (2, 'b'), (1, 'c'), (1, 'a')] > > it should be: > > >>> L = [(1, 'a'), (2, 'b'), (1, 'c'), (2, 'd'), (3, 'e')] > >>> reverseTuplesSort(L) > [(3, 'e'), (2, 'b'), (2, 'd'), (1, 'a'), (1, 'c')] > > No, it should not, because 'd'>'b' and 'c'>'a' ! tuple comparison compares both elements in lexicographic order. Cheers, E
_______________________________________________ Python-Dev mailing list -- python-dev@python.org To unsubscribe send an email to python-dev-le...@python.org https://mail.python.org/mailman3/lists/python-dev.python.org/ Message archived at https://mail.python.org/archives/list/python-dev@python.org/message/UWHPQ6TIX3S56ZGYW7BEMLBUCTUYHCQO/ Code of Conduct: http://python.org/psf/codeofconduct/