Index Ai Academy
Glossary · Phase 0 · Tools

Frozenset

Also written: frozensets

A set that can't be changed after it's made, so it can go inside another set or be a dictionary key.

Two more things you'll reach for. When you need to dedupe and keep the original order, a set can't do it alone, but a dictionary keeps insertion order: list(dict.fromkeys(items)) keeps the first of each. And when you need a set inside a set, or a set as a dictionary key, use a frozenset, a set that can't change after it's made, which makes it hashable.

Try it now

The right collection usually follows from one question: do you need order, names, or uniqueness?

Learn it properly

Sets: unique items and fast lookups · Duplicates, fast membership, set operations and comparing two lists. About 30 minutes.

Start this free lesson

Other terms from the same lesson

Never trained an AI?

Teach a small one to write, right in your browser. It takes about 20 seconds and needs no account.

Teach it to write