
+1 On Wed, 2022-01-19 at 07:20 +0000, Ben Rudiak-Gould wrote:
My preferred syntax for a frozenset literal would be something like
{1, 2, 3}.freeze()
This requires no new syntax, and can be safely optimized at compile time (as far as I can tell).
set.freeze would be a new method of sets which could also be used at run time. It would return a new frozenset object and wouldn't alter the set object (so perhaps the name I suggested isn't ideal). Of course frozenset.freeze would just return itself.
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/LYGTXE... Code of Conduct: http://python.org/psf/codeofconduct/