[Python-3000] sets in P3K?

Guido van Rossum guido at python.org
Mon May 1 19:35:53 CEST 2006


On 5/1/06, Raymond Hettinger <rhettinger at ewtllc.com> wrote:
> IOW, I recommend saving your big guns (alternative constructor syntaxes)
> for big problems whose solutions provide big rewards.   Set literals are
> barely worth the brain power that has already been expended in this
> thread.  If a set literal proposal isn't dirt simple, it is almost
> certainly a mistake.

Right. I see two proposals worthy of pursueing:

(a) {testlist} and {genexp} with the empty set written as set().

(b) Ditto but the empty set written as {/} or some other syntax that
doesn't already have a meaning.

Proposals that require us to change the way we write dict literals, or
that try to make {} ambiguously denote both an empty set and an empty
dict are off the table.

Since attempts to find an acceptable empty set notation for (b) seem
stalled on the acceptance of *anything*, I propose to go with (a) for
now -- it's simple to explain, similar to what people use on paper and
in textbooks, simple to implement, and syntactically unambiguous. The
minor notational discontinuity for empty sets is nothing compared to
the one we already have for singleton tuples. Plus, we can always
decide to approve {/} later -- which would still be a syntactic
discontinuity altough a much smaller one.

As Raymond says, upheaval of other notations isn't worth the minor
convenience that set literals provide.

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


More information about the Python-3000 mailing list