Set of sets in Python

If you try to create a set of dictionaries or a set of lists, the code is going to be executed without a problem.

Try to run the following code that represents a set of sets in Python.

The interpreter will return the following error:

Sets objects are mutable, but they can use mutable objects inside them, such as lists, sets or dicts.

What you can do in this case, is to create an immutable set object, called frozenset.

This is how it will look like in our code:

This is the result we are going to get: