[Python-ideas] Empty set, Empty dict
Guido van Rossum
guido at python.org
Tue Jun 10 18:39:56 CEST 2014
No. Jeez. :-(
On Tue, Jun 10, 2014 at 9:25 AM, Ryan Gonzalez <rymg19 at gmail.com> wrote:
> +1 for using {,}.
>
>
> On Tue, Jun 10, 2014 at 4:07 AM, Wichert Akkerman <wichert at wiggy.net>
> wrote:
>
>> Victor Stinner wrote:
>>
>>
>> 2014-06-10 8:15 GMT+02:00 Neil Girdhar <mistersheik at gmail.com <https://mail.python.org/mailman/listinfo/python-ideas>>:
>>
>>
>>
>> >* I've seen this proposed before, and I personally would love this, but my
>> *>* guess is that it breaks too much code for too little gain.
>> *>>* On Wednesday, May 21, 2014 12:33:30 PM UTC-4, Frédéric Legembre wrote:
>> *>>>>>>* Now | Future |
>> *>>* ----------------------------------------------------
>> *>>* () | () | empty tuple ( 1, 2, 3 )
>> *>>* [] | [] | empty list [ 1, 2, 3 ]
>> *>>* set() | {} | empty set { 1, 2, 3 }
>> *>>* {} | {:} | empty dict { 1:a, 2:b, 3:c }
>> *
>>
>> Your guess is right. It will break all Python 2 and Python 3 in the world.
>>
>> Technically, set((1, 2)) is different than {1, 2}: the first creates a
>> tuple and loads the global name "set" (which can be replaced at
>> runtime!), whereas the later uses bytecode and only store values
>> (numbers 1 and 2).
>>
>> It would be nice to have a syntax for empty set, but {} is a no-no.
>>
>>
>> Perhaps {,} would be a possible spelling. For consistency you might want
>> to allow (,) to create an empty tuple as well; personally I would find that
>> more intuitive that (()).
>>
>> Wichert.
>>
>>
>>
>>
>> _______________________________________________
>> Python-ideas mailing list
>> Python-ideas at python.org
>> https://mail.python.org/mailman/listinfo/python-ideas
>> Code of Conduct: http://python.org/psf/codeofconduct/
>>
>
>
>
> --
> Ryan
> If anybody ever asks me why I prefer C++ to C, my answer will be simple:
> "It's becauseslejfp23(@#Q*(E*EIdc-SEGFAULT. Wait, I don't think that was
> nul-terminated."
>
>
> _______________________________________________
> Python-ideas mailing list
> Python-ideas at python.org
> https://mail.python.org/mailman/listinfo/python-ideas
> Code of Conduct: http://python.org/psf/codeofconduct/
>
--
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20140610/52d2f8d5/attachment.html>
More information about the Python-ideas
mailing list