Python frozenset() built-in function
From the Python 3 documentation
Introduction
The frozenset()
function in Python is a built-in function that creates an immutable, hashable set from an iterable. Unlike a regular set
, a frozenset
cannot be modified after its creation, which means you cannot add or remove elements. This immutability makes it suitable for use as a dictionary key or as an element in another set.
Examples
>>> frozenset([1, 2, 3])
# frozenset({1, 2, 3})
>>> frozenset({1, 2, 3})
# frozenset({1, 2, 3})
>>> frozenset((1, 2, 3))
# frozenset({1, 2, 3})