[Python-Dev] Set data type

Greg Stein gstein@lyra.org
Thu, 3 Feb 2000 17:21:03 -0800 (PST)


On Thu, 3 Feb 2000, Ka-Ping Yee wrote:
>...
> So i think the clearest thing to do is to make sets a separate
> built-in type.  Here's the interface i was thinking of:

I might agree with this, but would not recommend special syntax for it. In
particular:

>     >>> s = {1, 5, 7}           # no colons means a set

Without a lot of hackery or post-parse validation (e.g. at byte-compile
time), the above syntax is not possible.

I think the follow is just as readable, if not more so:

    >>> s = set(1, 5, 7)

Where set() is a new builtin, taking an arbitrary number of arguments and
returning a new Set type.

The rest can easily follow once you have a Set object in hand.

Cheers,
-g

-- 
Greg Stein, http://www.lyra.org/