Question: Suppose I have the list [[1,2,3],[4,5,6],[3,2,1]], the first and last element (which are also lists) of the list are actually the same - they contain the same set of numbers, just with different order. If I want to create a function that takes in a list of list, and remove those duplicate list elements (in this case, remove either [1,2,3] or [3,2,1] and keep the remaining one), how do I do that?

thank you

Answer: 
Use a `set` and a `frozenset`.

Sets store only unique items and they are unordered. 

```
>>> {3, 1, 2} == {2, 1, 3}
True

```

But they can only store immutable items, so that's why we will also need a `frozenset`.

```
>>> {set([1, 2, 3])}
Traceback (most recent call last):
  File "<ipython-input-16-ddc0311520e7>", line 1, in <module>
    {set([1, 2, 3])}
TypeError: unhashable type: 'set'

>>> {frozenset([1, 2, 3])}
set([frozenset([1, 2, 3])])

```

**Demo:**

```
>>> lst = [[1,2,3],[4,5,6],[3,2,1]]
>>> seen = set()
>>> [x for x in lst if frozenset(x) not in seen and not seen.add(frozenset(x))]
[[1, 2, 3], [4, 5, 6]]

```
Convert each and every element of the list to a set and then to a tuple and form a new set to get the result you expect.

```
data = [[1,2,3],[4,5,6],[3,2,1]]
print(set(tuple(set(item)) for item in data))
# {(4, 5, 6), (1, 2, 3)}

```

We can use `frozenset` here, like this

```
print(set(frozenset(item) for item in data))
# {frozenset({1, 2, 3}), frozenset({4, 5, 6})}

```