What is the use of frozenset in Python?

A frozenset is a collection of unique values in Python. In addition to all the properties of set, a frozenset is immutable and hashable.

Once we have set the values in a frozenset, we cannot change. So we cannot use and update methods from set on frozenset.

Being hashable, we can use the objects in frozenset as keys in a Dictionary.

Read the full book at www.amazon.com
Posted in Python, Python Interview Questions

Leave a Reply

Your email address will not be published. Required fields are marked *

*