I have a hard time writing permutations. Once I find a new algorithm, I bump into mutability. Is there a way to append into newArray, but keep old values untouched?

**Or how should I modify it?**

```
newArray = []

def permutations(array):
    if array in newArray:
        return
    for i in range(len(array)):
        array[0], array[i] = array[i], array[0]
        newArray.append(array)
        permutations(array)
    return newArray

```