[Python-ideas] syntax for set

Terry Reedy tjreedy at udel.edu
Mon Nov 15 19:45:00 CET 2010

On 11/14/2010 10:23 PM, MRAB wrote:
> On 15/11/2010 03:15, Alexandre Conrad wrote:
>> Hi,
>> I am sure this has come up before and if it doesn't exist I believe
>> there is a good reason for it. Anyway, here's my thought: how about
>> having a syntax representation for sets? A mix of a dict and
>> list/tuple syntax would make the most sense, such as:
> [snip]
> This already exists in Python 2.7 and Python 3.

 >>> {1,2,3} == set((1,2,3))

The *only* glitch is the lack of an empty set notation. The idea of
dict() == {:}; set()=={};
which would be the obvious choice if starting fresh,
was considered but rejected by Guido as too disruptive
and introducing another barrier between Python 2 and 3.

Terry Jan Reedy

More information about the Python-ideas mailing list