[Python-3000] sets in P3K?

Guido van Rossum guido at python.org
Thu Apr 27 04:47:58 CEST 2006


On 4/26/06, Talin <talin at acm.org> wrote:
> A set with a single element is:
>
>    {1,}
>
> In other words, we steal the idea from tuples - a trailing comma is used as a
> way to signal that this is a comma-separated list of one item.

There's no need for this; there's no ambiguity. The ambiguity only
starts for empty sets (unlike for tuples).

> A set with no elements is:
>
>    set()

If we don't come up with something better I can live with this.

> Alternatively, you could take the tuple idea one step further:
>
>    {,}
>
> However, I'm not sure I like this very much.

I'm sure I don't.

--
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list