All permutations of a list

Emile van Sebille emile at fenx.com
Mon Oct 23 00:42:25 EDT 2000


def perms3(list):
  return [[[list[i]] + p for i in range(len(list))\
    for p in perms3(list[:i] + list[i+1:])],[[]]] [not list]

This one works, ugly as it is.  Now, if the items are
reversed so that the empty list is element 0, is there a way
to return either a 0 or 1 other that 'not not list'?



--

Emile van Sebille
emile at fenx.com
-------------------






More information about the Python-list mailing list