You could sort the tuples and use set
to check for duplicates as tuples are hashable
a=[(-1, 0, 1) ,(-1, 1, 0), (-1, 2, -1) ,(-1, -1, 2), (0, 1, -1)]
my_set=set()
res=[]
for original_value, sorted_value in zip(a,map(sorted,a)):
if tuple(sorted_value) not in my_set:
res.append(original_value)
my_set.add(tuple(sorted_value))
Output
[(-1, 0, 1), (-1, 2, -1)]
Can use defaultdict
from collections import defaultdict
d=defaultdict(list)
a=[(-1, 0, 1) ,(-1, 1, 0), (-1, 2, -1) ,(-1, -1, 2), (0, 1, -1)]
res=[]
for original_value, sorted_value in zip(a,map(sorted,a)):
d[tuple(sorted_value)].append(original_value)
Output:
{
(-1, -1, 2): [(-1, 2, -1), (-1, -1, 2)],
(-1, 0, 1): [(-1, 0, 1), (-1, 1, 0), (0, 1, -1)]
}