I am trying to generate a permutation of list in python with recursion.
import copy
def perm(seq):
    if len(seq) == 1:
        return seq
    else:
        nseq = perm(seq[1:])
        return zip_letter(seq[0], nseq)
def zip_letter(c, seq):
    lis = []
    for i in range(len(seq)+1):
        seq.insert(i, c)
        lis.append(copy.deepcopy(seq))
        seq.pop(i)
    return lis
print perm(['a', 'b', 'c'])
The output is [['a', ['b', 'c'], ['c', 'b']], [['b', 'c'], 'a', ['c', 'b']], [['b', 'c'], ['c', 'b'], 'a']]
which seems fine, but not in correctly inserted format. what am i missing?