AI engineering glossary · Python core

What is frozenset?

frozenset: An immutable version of a set. Its elements cannot be added or removed after creation, so it is hashable and can be used as a dictionary key or as an element of another set.

Level: advancedTopic: Python core

frozenset: an example

key = frozenset({'a', 'b'}); d = {key: 1} works, while using a normal set as a key raises TypeError.

Related terms

More Python core terms

Where you learn it

frozenset is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.