[Python-ideas] syntax for set

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Nov 15 21:56:46 CET 2010

Guido van Rossum wrote:
> There is nothing obvious about {:} for the empty dictionary. :-)

I think it has about the same level of obviousness as (x,)
for a 1-element tuple. You would have to learn it, but
after that you could easily remember which is which, because
dicts are made with colons and sets aren't.

A backwards-compatible alternative would be to use {.}
for an empty set. Think of a set as half a dict, and the
dot as half a colon. :-)


More information about the Python-ideas mailing list