[Python-ideas] syntax for set

Guido van Rossum guido at python.org
Mon Nov 15 20:02:53 CET 2010


There is nothing obvious about {:} for the empty dictionary. :-)

On Mon, Nov 15, 2010 at 10:45 AM, Terry Reedy <tjreedy at udel.edu> wrote:
> 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))
> True
>
> 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
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> http://mail.python.org/mailman/listinfo/python-ideas
>



-- 
--Guido van Rossum (python.org/~guido)



More information about the Python-ideas mailing list