Hua Lu <gotoalanlu@gmail.com> wrote:
This is similar to another proposal: http://mail.python.org/pipermail/python-3000/2008-January/011798.html
Anyway, I was using ast.literal_eval and attempted to use frozenset({...}) as a key in a dictionary, which failed, because frozenset isn't a literal (though putting frozenset in the environment would be a security risk). I am currently working around this with tuples, but I'd like a literal for representing frozensets as well. I also use frozensets elsewhere in the code in ways similar to Raymond's original suggestion.
Perhaps something like f{...} for declaring frozenset( comprehension)? literals?
------------------------------------------------------------------------
_______________________________________________ Python-ideas mailing list Python-ideas@python.org http://mail.python.org/mailman/listinfo/python-ideas
What about {1, 2, 3}.frozen() ? While not exactly new syntax, i think it would be a good short way to create a frozenset. -- Markus