Oct. 30, 2021
4:32 p.m.
Hi, On Sat, 30 Oct 2021 at 16:23, Raymond Bisdorff <raymond.bisdorff@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