# PEP 814: Add frozendict built-in type

**URL:** <https://discuss.python.org/t/pep-814-add-frozendict-built-in-type/104854>\
**Category:** PEPs\
**Tags:** builtins\
**Created:** [November 13, 2025, 9:53am UTC](https://discuss.python.org/t/pep-814-add-frozendict-built-in-type/104854 "2025-11-13T09:53:50Z")\
**Posts on this page:** 1\
**Showing post:** 20

<div class="post-metadata">

**Author:** ![brettcannon](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/brettcannon/32/34895_2.png) [@brettcannon](https://discuss.python.org/u/brettcannon)\
**Post date:** [November 14, 2025, 12:37am UTC](https://discuss.python.org/t/pep-814-add-frozendict-built-in-type/104854/20 "2025-11-14T00:37:44Z")

</div>

> [@barry](#):
>
> > [@vstinner](#):
> >
> > Do you think that they should be made public?
> 
> I think so; it seems like it would be a commonly used API.

We can also make it a bit more generic and somehow check for the mapping protocol.

> [@pgdr](#):
>
> Is there a plan of letting `pprint` know about `frozendict`?

Without talking to the PEP authors I can guarantee that pprint would get updated if the PEP was accepted.

> [@eendebakpt](#):
>
> For a (shallow) copy we can return a new reference.

The potential issue with that is C code could do some shenanigans with the underlying data and invalidate that those two “copies” are the same. If you know you’re working with a frozendict you’re going to avoid bothering with copies anyway, so it shouldn’t be a big deal in the end.

> [@dmoisset](#):
>
> Something that would help with that is an _in-place_ transformation from `dict` to `frozendict`.

But now you have made that dictionary frozen for everyone who holds a reference to it, which means side-effects at a distance in a way that could be unexpected (e.g. context switch in a thread and now suddenly you’re going to get an exception trying to mutate what was a dict a microsecond ago but is now frozen). That seems like asking for really nasty debugging issues just to optimize some creation time.

Remember this is not being pitched as a perf win, but as a way to lessen bugs in concurrent code because you can’t share immutable dicts write now. And we tend to try and design around programmer ergonomics more than perf and this suggestion seems to go against that general goal.

---

_[View the full topic](https://discuss.python.org/t/pep-814-add-frozendict-built-in-type/104854)._
