After careful deliberation, the Python Steering Council is pleased to accept PEP 814 – Add frozendict built-in type.
The absence of an immutable dict counterpart has been a long-standing gap in Python and has been requested for a long time in different forms. We agree this is a clear net positive for the language. We are accepting this PEP with the following modifications:
- Performance should not be framed as a goal or motivation. The value of frozendict is in its immutability semantics, not in being faster than dict. Any performance implications are not compelling enough to highlight.
- The thread safety claims should be toned down. frozendict is only shallowly immutable: mutable values inside it can still be modified from other threads without synchronization. The rationale reads better when focused on hashability, safe defaults, and structural immutability rather than leaning on free threading.
- The docs should clearly note that frozendict is not a dict subclass. We acknowledge that this should be evident, as the design mirrors set/frozenset, but dicts are much more pervasive and developers will naturally try to pass a frozendict where a concrete dict is required (e.g. as the globals argument to exec), leading to exceptions.
- The docs should also be clear about the hashability semantics of frozendicts, with care taken to describe the requirement that both keys and values must be hashable for the frozendict to be hashable.
- Stdlib adoption should happen with each module maintainer’s approval, not as a mechanical sweep.
Congratulations to Victor and Donghee! We look forward to seeing frozendict in Python 3.15!
— The Python Steering Council