Re: [Tutor] help with list permutations

2008-01-04 Thread Kent Johnson
Chris Fuller wrote: > This is a good case for recursion. My solution is in two steps. > Here is the code: > > def recursion_is_your_friend(l): >if len(l) == 1: > return l >else: > return [ (i, recursion_is_your_friend(l[1:])) for i in l[0] ] > > l = recursion_is_your_friend([[

Re: [Tutor] help with list permutations

2008-01-03 Thread Chris Fuller
This is a good case for recursion. My solution is in two steps. A straightforward application of recursion (I was casting about semi-randomly) yields a attractive tree structure: root a b c d e c de f f f f ff g h

[Tutor] help with list permutations

2008-01-03 Thread c t
Greeting from a real newbie, I think that their might exist an easy way, in Python, for my list permutation issue. I need to be able to permute all elements from across several lists, while ensuring order is maintained across the lists. For example: list1=[a b] list2=[c d e] list3=[f] list4=[