I read in a book which stated due to "algorithmic underpinnings", only instances of immutable types can be added to a Python set, but it did not explain what are those "algorithmic underpinnings".
After trying to actually add a list (mutable data type) to set, I got an error saying TypeError: unhashable type: list, but again why does the item to be added has to be hashable?
>>> my_set = set()
>>> my_set.add('a')
>>> my_set.add(1)
>>> my_set.add((1,2,3))
>>> my_set.add([1,2,3])
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: unhashable type: 'list'