[Python-ideas] Empty set {} and empty dict {:} ?

George Sakkis george.sakkis at gmail.com
Thu Jan 17 19:23:45 CET 2008


On Jan 17, 2008 1:10 PM, Steven Bethard <steven.bethard at gmail.com> wrote:
> On Jan 17, 2008 3:15 AM, Mark Summerfield <mark at qtrac.eu> wrote:
> > I just wondered if changing the empty set & dict syntax might be
> > possible.
> >
> >     s = {}  # empty set
> >     d = {:} # empty dict
> >
> > I think this would be more understandable to newcomers since to create
> > single element ones we have:
> >
> >     s = {1}
> >     d = {1:1}
> >
> > ?
>
> This was discussed when set literals were added.  It was decided that
> it would be too much of a backwards incompatibility even for Python
> 3.0.  It may be worth re-considering for Python 4.0.  ;-)

How about {/} for empty sets ? (although chances are that this or
something similar has been discussed and rejected too :)).

George



More information about the Python-ideas mailing list