On Wed, Jan 19, 2022 at 02:20:06PM +0100, Marco Sulla wrote:
> I can understand, but if you do it for set, why not for list,
> bytearray... And so it becomes a sort of protocol for freezing
If you want a frozen list, you can already write that as a tuple. There
is no need to do:
[1, 2, 3].frozen()
when you can just write `(1, 2, 3)`. Same for bytearray and bytes.
We already have display or literal syntax for frozen lists and frozen
bytearrays. It is only frozensets which don't, and since people cannot
agree on syntax for a frozenset display, we're stuck with approaching it
side-ways: a method call which, if applied to a set display of literals,
could be safely optimized out by the compiler.
The rest of the time, someset.frozen() would just call frozenset.