itertools.permutations generates where its elements are treated as unique based on their position, not on their value. So basically I want to avoid duplicates like this:
You could try using set:
>>> list(itertools.permutations(set([1,1,2,2]))) [(1, 2), (2, 1)]
The call to set removed duplicates