[Python-ideas] Fwd: Extremely weird itertools.permutations

MRAB python at mrabarnett.plus.com
Sun Oct 13 22:04:21 CEST 2013


On 13/10/2013 20:34, Oscar Benjamin wrote:
> On 13 October 2013 19:29, Neil Girdhar <mistersheik at gmail.com> wrote:
>> Did you read the problem?
>
> I did but since you showed some code that you said you were working on
> I thought you'd be interested to know that it could be improved.
>
>> Anyway, let's not get off topic (permutations).
>
> Getting back to your proposal, I disagree that permutations should be
> "fixed". The current behaviour is correct. If I was asked to define a
> permutation I would have given definition #3 from Steven's list: a
> bijection from a set to itself. Formally a permutation of a collection
> of non-unique elements is not defined.
>
> They may also be uses for a function like the one that you proposed
> but I've never needed it (and I have used permutations a few times)
> and no one in this thread (including you) has given a use-case for
> this.
>
Here's a use case: anagrams.



More information about the Python-ideas mailing list