How to make a shallow copy of a list in Python

To make a shallow copy, you can slice the list:

newprefix = prefix[:]

Or pass it into the list constructor:

newprefix = list(prefix)

Also, I think you can simplify your code a little:

def perm(prefix, rest):
    print prefix, rest

    for i in range(len(rest)):
        perm(prefix + [rest[i]], rest[:i] + rest[i + 1:])

perm([], ['a','b','c'])

import copy

a = [somestuff]
b = copy.copy(a) # Shallow copy here.
c = copy.deepcopy(a) # Deep copy here.

The copy module is worth knowing about. https://docs.python.org/3/library/copy.html

(Python 2) http://docs.python.org/2/library/copy.html