In article <[EMAIL PROTECTED]>,
 "Girish Sahani" <[EMAIL PROTECTED]> wrote:

>  I want to generate all permutations of a string.

def permute(Seq) :
    """generator which yields successive permutations of the elements
    of Seq."""
    if len(Seq) == 0 :
        yield ()
    else :
        for i in range(0, len(Seq)) :
            for rest in permute(Seq[:i] + Seq[i + 1:]) :
                yield (Seq[i],) + rest
            #end for
        #end for
    #end if
#end permute
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to