It uses a list generator and "yield":
#!/usr/bin/env python
def permut(lst):
remove = lambda lst0, index: lst0[:index] + lst0[index+1:]
if lst:
for index, x in enumerate(lst):
for y in permut(remove(lst, index)):
yield (x,)+y
print y
else: yield ()
lst='catalin'
for p in permut(['c','a','t','a','l','i','n']):
print p
Example can be modified so output will be a file.