[Python-ideas] Sets, Dictionaries

Chris Angelico rosuav at gmail.com
Thu Mar 29 11:48:32 EDT 2018


On Fri, Mar 30, 2018 at 2:42 AM, Julia Kim <julia.hiyeon.kim at 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 = {:}
>
>
> Compatibility issues could be resolved with a program which takes a Python program (codes) as a text and edits it.
>

Unfortunately, that's not sufficient for backward compatibility.
Imagine reading something on Stack Overflow that has this line of code
in it:

words = {}

Does that make an empty set or an empty dict? How would anyone know?
Are you going to go through every piece of code on Stack Overflow and
change it? What about all the blogs out there? Printed books?

Simply transforming code doesn't work. Having the same syntax perform
drastically different things on different versions of the interpreter
is almost certainly not going to fly.

The only way that this might be usable is if you use a __future__
directive. And if it were done that way, I would expect most code out
there to NOT use the directive, and therefore to keep today's
semantics - which means the change effectively hasn't happened for
most people.

ChrisA


More information about the Python-ideas mailing list