[Python-ideas] Sets, Dictionaries

Stephan Houben stephanh42 at gmail.com
Thu Mar 29 12:00:41 EDT 2018


Perhaps one day we will be able to use

∅

for the empty set.
That would actually match conventional notation.

Note that this is not valid syntax today (not a legal Unicode identifier).

Stephan

Op do 29 mrt. 2018 17:49 schreef Chris Angelico <rosuav at gmail.com>:

> 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
> _______________________________________________
> 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/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20180329/caa42341/attachment.html>


More information about the Python-ideas mailing list