I often do sorts in Python using lambda expressions, and although it works fine, I find it not very readable, and was hoping there might be a better way. Here is a typical use
Not elegantly, but:
[a for (v, a) in sorted((x[a], a) for a in y)]
BTW, you can do this without creating a separate list of indices:
[i for (v, i) in sorted((v, i) for (i, v) in enumerate(x))]