# PEP 841: Adding Frozen Syntax to Make Immutable Types Optimizable

**URL:** <https://discuss.python.org/t/pep-841-adding-frozen-syntax-to-make-immutable-types-optimizable/108219>\
**Category:** PEPs\
**Created:** [July 20, 2026, 2:55am UTC](https://discuss.python.org/t/pep-841-adding-frozen-syntax-to-make-immutable-types-optimizable/108219 "2026-07-20T02:55:49Z")\
**Posts on this page:** 1\
**Showing post:** 3

<div class="post-metadata">

**Author:** ![corona10](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/corona10/32/9943_2.png) [@corona10](https://discuss.python.org/u/corona10)\
**Post date:** [July 20, 2026, 5:50am UTC](https://discuss.python.org/t/pep-841-adding-frozen-syntax-to-make-immutable-types-optimizable/108219/3 "2026-07-20T05:50:49Z")

</div>

> [@emmatyping](#):
>
> 1. Are there significant performance gains to be won here, and have you investigated what that might look like? I understand that syntax is easier to optimize but I don’t see any analysis of what the impact of the optimization would be other than there are ~100 sites of frozen containers in CPython. It isn’t clear to me if the performance wins are worth the new syntax.

I think this is a chicken-and-egg problem. If immutable containers do not offer the same level of support as their mutable counterparts, people will be less likely to use them, especially since they share most of the same underlying structure apart from mutation operations.  
One of our main goals is therefore to enable the same level of optimization and usage through syntax for immutable containers.

> [@emmatyping](#):
>
> 1. Have you done any research into whether users would be easily confused with f-strings? The fact that we are giving a new meaning to an f prefix might confuse users. Perhaps it would be useful to confer with some Python educators or hold a poll about it and cover the results in the “How to teach this” section.

Actually, we had a poll for this [`frozenset` and `frozendict` comprehensions - #48 by sobolevn,](https://discuss.python.org/t/frozenset-and-frozendict-comprehensions/101584/48) and I believe that the f prefix would not be a bad choice with the reasons that I listed.

> [@emmatyping](#):
>
> 1. In rejected ideas you say that freezing methods are not real alternatives but do not discuss why. I think it would be good to cover that because it is not immediately evident to me.

Thanks will do 🙂

---

_[View the full topic](https://discuss.python.org/t/pep-841-adding-frozen-syntax-to-make-immutable-types-optimizable/108219)._
