Timeline for Sort a list by multiple attributes?
Current License: CC BY-SA 3.0
5 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 17, 2017 at 7:21 | comment | added | Andrei-Niculae Petre |
since 2nd is a number, it works to do it like b = sorted(a, key = lambda x: (-x[1], x[0])) which is more visible on which criteria applies first. as for efficiency I'm not sure, someone needs to timeit.
|
|
Apr 22, 2016 at 1:40 | review | Late answers | |||
Apr 22, 2016 at 1:50 | |||||
Apr 22, 2016 at 1:28 | history | edited | Clint Blatchford | CC BY-SA 3.0 |
improved formatting
|
Apr 22, 2016 at 1:22 | review | First posts | |||
Apr 22, 2016 at 1:28 | |||||
Apr 22, 2016 at 1:20 | history | answered | Clint Blatchford | CC BY-SA 3.0 |