什么是更好的方式让我从一个线条连接组合创建独特的设置?从组合创建res之后我知道我可以使用几个循环来过滤掉元组的重复值,但是如果有更好的方法呢?

nums = [0, 0,1,-1, 0]
from itertools import list(combinations(nums, 2))
res = [(0, 0), (0, 1), (0, -1), (0, 0), (0, 1), (0, -1), (0, 0), (1, -1), (1, 0), (-1, 0)]
#expect=> [(0, 0), (0, 1), (0, -1), (1, -1)]

better way? so put them into one-line
from itertools import combinations
nums =  [0, 0,1,-1, 0]
res, col = [], []
for i in combinations(nums, 2):
    if set(i) not in col:
        res.append(i)
        col.append(set(i))
#res = [(0, 0), (0, 1), (0, -1), (1, -1)]