# \`frozenset\` and \`frozendict\` comprehensions

**URL:** <https://discuss.python.org/t/frozenset-and-frozendict-comprehensions/101584>\
**Category:** Ideas\
**Created:** [August 7, 2025, 6:32pm UTC](https://discuss.python.org/t/frozenset-and-frozendict-comprehensions/101584 "2025-08-07T18:32:59Z")\
**Posts on this page:** 1\
**Showing post:** 48

<div class="post-metadata">

**Author:** ![sobolevn](https://sea2.discourse-cdn.com/flex002/user_avatar/discuss.python.org/sobolevn/32/9274_2.png) [@sobolevn](https://discuss.python.org/u/sobolevn)\
**Post date:** [July 8, 2026, 1:56pm UTC](https://discuss.python.org/t/frozenset-and-frozendict-comprehensions/101584/48 "2026-07-08T13:56:38Z")

</div>

I implemented both versions with `f` and `$` as prefixes for `{` 🙂

- `f`: [Comparing main...c9004e5977a05d5ac644e1741adc446af96d0f29 · python/cpython · GitHub](https://github.com/python/cpython/compare/main...c9004e5977a05d5ac644e1741adc446af96d0f29)
- `$`: [https://github.com/python/cpython/pull/152820/commits/657fff2f18a84601a180f1be74876c537fc9b7eb](https://github.com/python/cpython/compare/main...sobolevn:cpython:wip-frozen-syntax)

Now, we would have to decide which one is better. There are several concerns for each of them:

- `f`
- Looks like fstring: `f{0}` and `f'{0}'`, but does a completely different thing: **F** rozen vs **F** ormat
- In fstring you can use both `F` and `f`, it would be strange to allow the same for `f{`. So, it would be incosinstent
- It is rather hard to read when these things are nested: `f{f'{user}', f'{task}'}`
- It does not scale for other possible similar syntax (which is not a part of the proposal, but just a possibiliy for the future). Because `f()` and `f[]` are already valid as a syntax

Now, the second option:

- `$`
- It is a new unfamiliar thing, that people might associate with PHP or BASH
- It one of the last unused symbols in the syntax

Why not some other options?

- No identifiers apply because of the scalability concerns
- No suffixes apply, because it is hard to read
- No chars that are used in operators apply, because they create ambiguity when parsing
- No existing valid syntax apply, we can’t break stuff. So, things like `{{}}` won’t work ☹

We are left with very little options, which are reasonable. With this in mind: please, vote 🙂

_Poll ([view on site](https://discuss.python.org/t/frozenset-and-frozendict-comprehensions/101584/48))_

---

_[View the full topic](https://discuss.python.org/t/frozenset-and-frozendict-comprehensions/101584)._
