On 30 March 2018 at 02:04, Clint Hepner <clint.hep...@gmail.com> wrote:
>
>> On 2018 Mar 29 , at 11:42 a, Julia Kim <julia.hiyeon....@gmail.com> wrote:
>>
>> My suggestion is to change the syntax for creating an empty set and an empty 
>> dictionary as following.
>>
>> an_empty_set = {}
>> an_empty_dictionary = {:}
>
> If you are willing to accept {:} as an empty dict, then surely {,} would 
> suffice as an empty set, with no backwards compatibility issues at all.
>
> Also, this is also not a new idea 
> (https://mail.python.org/pipermail/python-3000/2006-April/001286.html). I 
> don't know
> if this was never seriously considered further, or if it was formally 
> rejected.

I believe the main concern is that where "set()" is easy to look up in
documentation, "{,}" isn't all that obvious (and isn't easy to search
for), so folks would have to learn it by rote.

It would also lead to the question of "If {,} is allowed for empty
sets, why don't we allow (,) for empty tuples, and [,] for empty
lists?".

That said, a case could potentially be made for "Disambiguating empty
container notation" that allowed all four options:

* Unambiguous empty dict: {:}
* Syntactic empty set: {,}
* Empty tuple with optional comma: (,)
* Empty list with optional comma: [,]

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to