Hacker News new | ask | show | jobs
by rmc 4562 days ago
Elsewere, say you want to sort a non-omogeneous list, or according to a custom order (attribute1 descending, attribute2 ascending) cmp make this easy

You can do this in python with the key function returning a list/tuple:

    mylist.sort(key=lambda element: (element.attribute1, -element.attribute2))
1 comments

I'm not sure you can do -"string" :)