>>> from sympy.utilities.iterables import permutations >>> for i in permutations(range(3)): ... print i ... (0, 1, 2) (0, 2, 1) (1, 0, 2) (1, 2, 0) (2, 0, 1) (2, 1, 0)
;-) but if you help(permutations) you will see that we have just imported permutations from itertools. Also note that we have multiset_permutations (and one for combinations and partitions) for generating unique permutations of lists that contain repeated elements >>> for i in permutations('aab'): ... print i ... ('a', 'a', 'b') ('a', 'b', 'a') ('a', 'a', 'b') ('a', 'b', 'a') ('b', 'a', 'a') ('b', 'a', 'a') >>> for i in multiset_permutations('aab'): ... print i ... ['a', 'a', 'b'] ['a', 'b', 'a'] ['b', 'a', 'a'] -- You received this message because you are subscribed to the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to sympy+unsubscr...@googlegroups.com. To post to this group, send email to sympy@googlegroups.com. Visit this group at http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/14a259fc-dc5b-43c3-b10a-84765f2c3f92%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.