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
> objects.
YAGNI.
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.
--
Steve
_______________________________________________
Python-ideas mailing list -- [email protected]
To unsubscribe send an email to [email protected]
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at
https://mail.python.org/archives/list/[email protected]/message/WVMP4PW2K66I6KVYWQU3FSDMB7XB7TSB/
Code of Conduct: http://python.org/psf/codeofconduct/