Version-Specific Features

Python 3.15 — Immutable dictionary type

A built-in immutable mapping that preserves dictionary-style access. Its contents cannot be reassigned, and hashability depends on the contents; freezing a mapping is not recursive deep immutability. Requires Python 3.15 or the relevant build; example is not executed locally.

Formal Syntax & Structure

python syntaxpython
frozendict(mapping)

Return Value

Feature-specific

No single return type; see the example and feature description.

Working Example

Example Snippetpython
settings = frozendict({'retries': 3})print(settings['retries'])try:    settings['retries'] = 4except TypeError:    print('immutable')
Python Reference