0

I have a list of sets:

setlist = [{1,2},{3,4},{2,1}]

I want to have a list which contains only unique sets (ie: result = [{1,2},{3,4}]). I have tried the suggestion of How to make lists contain only distinct element in Python?, ie:

list(set(setlist))

and the suggestions from Removing duplicates in lists :

list(dict.fromkeys(setlist))

Both of them returns:

TypeError: unhashable type: 'set'

I don't need to preserve order, the tricks suggested in this thread above are mainly about preserving order.

zabop
  • 5,493
  • 3
  • 23
  • 56

0 Answers0