List : Tuple :: Set : ?
Dictionaries in Python require their keys to be immutable. As a result, a set cannot be used as keys as it is mutable.
Yet, if you want to use a set, consider declaring it as a frozenset.
It is an immutable set, meaning its elements cannot be changed after it is created. Therefore, they can be safely used as a dictionary’s key.
Share this post on LinkedIn: Post Link.
Find the code for my tips here: GitHub.
I like to explore, experiment and write about data science concepts and tools. You can read my articles on Medium. Also, you can connect with me on LinkedIn.