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

Georg Brandl g.brandl at gmx.net
Thu Jan 17 19:30:42 CET 2008


George Sakkis schrieb:
> 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 :)).

It has been discussed and rejected. :)

Georg




More information about the Python-ideas mailing list