Permutations with generators
tn.pablo at gmail.com
Sat Jul 21 08:18:45 CEST 2007
> list.insert returns None. Thus, except in the one-element case, your
> generator is yielding None all the time.
Oh god...silly me.
Thank you guys for the help :)
P.S I'm dead stubborn, so here's what I did to fix my code:
"Reshuffles the elements of seq in every possible way"
if len(seq) == 1:
for i in range(len(seq)):
for p in perm(seq[1:]):
More information about the Python-list