[Python-ideas] frozenset literals

MRAB python at mrabarnett.plus.com
Sat Feb 2 19:30:30 CET 2013


On 2013-02-02 14:28, Antoine Pitrou wrote:
> On Sun, 03 Feb 2013 01:20:38 +1100
> Steven D'Aprano <steve at pearwood.info> wrote:
>>
>> Unfortunately the proposal to use f{ ... } for frozen sets cannot work within the constraints of Python's lexer:
>>
>> http://mail.python.org/pipermail/python-3000/2008-January/011838.html
>>
>> Unfortunately we're running out of useful, easy to enter symbols for literals. Until such time (Python4000 perhaps, or more likely Python5000) as we can use a rich set of Unicode literals, I don't think there is any clear way to have a frozenset literal.
>
> I'm not sure what the point is. frozensets are too rarely used to
> deserve a literal notation.
>
Does it need a special notation as such?

Wouldn't an alternative be to support "frozenset(...)" where "..." is
parseable by ast.literal_eval()?

The same thing could be done with some other built-in classes.



More information about the Python-ideas mailing list