is there a way to sort a list first for x, than y and than z. I'm not sure if my code will do it: (ch is a object with the attribut left_edge)
ch.sort(cmp=lambda x,y: cmp(x.left_edge[0], y.left_edge[0]))
ch.sort(cmp=lambda x,y: cmp(x.left_edge[1], y.left_edge[1]))
ch.sort(cmp=lambda x,y: cmp(x.left_edge[2], y.left_edge[2]))
Simple example:
unsorted
(1,1,2),(2,1,1),(1,1,3),(2,1,2)
sorted
(1,1,2),(1,1,3),(2,1,1),(2,1,2)
but I need the sorted objects...