<html><head><meta http-equiv="Content-Type" content="text/html charset=iso-8859-1"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Oct 13, 2013, at 1:56 PM, Neil Girdhar <<a href="mailto:mistersheik@gmail.com">mistersheik@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><span style="font-family: Arial; font-size: medium; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; orphans: 2; text-align: -webkit-auto; text-indent: 0px; text-transform: none; white-space: normal; widows: 2; word-spacing: 0px; -webkit-text-size-adjust: auto; -webkit-text-stroke-width: 0px; display: inline !important; float: none; "> I'm now convinced that itertools.permutations is fine as it is.  I am not totally convinced that multiset_permutations doesn't belong in itertools,</span></blockquote></div><div><br></div><div>Now that we have a good algorithm,  I'm open to adding this to itertools,</div><div>but it would need to have a name that didn't create any confusion</div><div>with respect to the existing tools, perhaps something like:</div><div><br></div><div>    anagrams(population, r)</div><div><br></div><div>    Return an iterator over a all distinct r-length permutations</div><div>    of the population.</div><div><br></div><div>    Unlike permutations(), element uniqueness is determined</div><div>    by value rather than by position.  Also, anagrams() makes</div><div>    no guarantees about the order the tuples are generated.</div><div><br></div><div><br></div><div><br></div><div>Raymond</div></body></html>