sorting "problem"

Bror Johansson bror.johansson at saabtech.se
Tue Nov 4 04:48:33 EST 2003


Assume having defined two lists. There will be a one-to-one relationship
between elements in the two lists.

Is there a way to - when calling listA.sort() - have elements in listB
shuffled the same as those in listA? When calling listB.sort(), the listA
should be sorted alikewise.

[I know how to circumvent the problem - e.g. by creating a temporary list
with associated elements in tuples, sort this list and eventually extract
the two separate lists.]

Nevertheless, I'm curious whether it is possible - and if it is, how to -
associate two - or more - lists with respect to sorting.

/BJ






More information about the Python-list mailing list