[Python-ideas] syntax for set
Alexandre Conrad
alexandre.conrad at gmail.com
Mon Nov 15 21:34:25 CET 2010
2010/11/15 spir <denis.spir at gmail.com>:
> [sorry, sent unintentionally]
>
> On Mon, 15 Nov 2010 11:02:53 -0800
> Guido van Rossum <guido at python.org> wrote:
>
>> There is nothing obvious about {:} for the empty dictionary. :-)
{:} for empty dict could make some sense. If that is ever accepted, it
will probably go in Python 4 as the change is so important.
> Anyone votes for {/} meaning empty set?
-1.
List, tuple and dict have their own literals. Now sets shares dict's
literals. That's why I proposed using a new container literal for
sets, such as <1, 2, 3> where an empty set would be <>. As lists and
tuples are the mutable/immutable pairs, I thought we could have
literals for frozenset as well. But I can no longer find available
opening/closing symbols on my keyboard. Darn.
I also thought about doubling braces, such as {{1, 2, 3}}, then {{}}
for an empty set would work. (and probably break some templating
engines out there ;)). But it conflicts with "a dict in a set" (which
is unhashable anyway, but that's not a valid reason).
--
Alex | twitter.com/alexconrad
More information about the Python-ideas
mailing list