>
> 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:

def perm(seq):
        "Reshuffles the elements of seq in every possible way"
        if len(seq) == 1:
                yield seq
        else:
                for i in range(len(seq)):
                        for p in perm(seq[1:]):
                                # Here:
                                p.insert(i, seq[0])
                                yield p


-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to