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

Steven Bethard steven.bethard at gmail.com
Thu Jan 17 19:10:10 CET 2008


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.  ;-)

Steve
-- 
I'm not *in*-sane. Indeed, I am so far *out* of sane that you appear a
tiny blip on the distant coast of sanity.
        --- Bucky Katt, Get Fuzzy



More information about the Python-ideas mailing list