From what I understand of your question, it appears that you want to apply a permutation that you specify on a `list`

. This is done by specifying another `list`

(lets call it `p`

) that holds the indices of the elements of the original `list`

that should appear in the permuted `list`

. You then use `p`

to make a new `list`

by simply substituting the element at each position by that whose index is in that position in `p`

.

```
def apply_permutation(lst, p):
return [lst[x] for x in p]
arr=list("abcde")
new_order=[3,2,0,1,4]
print apply_permutation(arr,new_order)
```

This prints `['d', 'c', 'a', 'b', 'e']`

.

This actually creates a new `list`

, but it can be trivially modified to permute the original “in place”.