By the way, I myself, have this solution:

How can we get the indices of values in the original list after sorting a
> list?
>
>
(Pdb) A=[ 1, -1, 0, 7, 9, 1.3, 2.9 ]
(Pdb) sorted(zip(A, range(len(A))), key = lambda x: x[0])
[(-1, 1), (0, 2), (1, 0), (1.3, 5), (2.9, 6), (7, 3), (9, 4)]


But compared to what Matlab neatly does, it's too ugly:


> If you know Matlab, in Matlab you'll write:
>
> [B,L] = sort(A)
>
>
A
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to