Time we switched to unicode? (was Explanation of this Python language feature?)

Antoon Pardon antoon.pardon at rece.vub.ac.be
Tue Mar 25 15:01:09 CET 2014

On 25-03-14 14:36, Steven D'Aprano wrote:
> On Tue, 25 Mar 2014 08:21:19 -0400, Roy Smith wrote:
>> In article <mailman.8511.1395743071.18130.python-list at python.org>,
>>  Antoon Pardon <antoon.pardon at rece.vub.ac.be> wrote:
>>> Come on. The problem isn't that both set and dictionary literal use
>>> braces. That doesn't seem to be a problem in python3. The only question
>>> was what should {} represent and how do we get an empty collection of
>>> the other kind. If {} had been an empty set, dict() could have been
>>> used for an empty dictionary is {:} had been unacceptable.
>> By analogy to tuples, it could have been {,}.
> An empty tuple is (), not (,). {,} is just making up random syntax almost 
> unrelated to anything else. One might as well used {?} or {+}.
> If Python 3 had introduced {} to mean the empty set, I *guarantee* that 
> right now people would be arguing that "Python 3 could have used {} for 
> the empty dict, and used set() for the empty set" -- and very likely the 
> same people now arguing the opposite.

Sure and other people would have defended that choice and very likely
the same people that are defending the current choice now. What is 
your point?

> Yes, Python could have changed the meaning of {} to mean the empty set. 
> But you know what? The empty set is not that important. Sets are not 
> fundamental to Python. Python didn't even have sets until 2.3, and at 
> first they were just a standard library module, not even built-in. Dicts, 
> on the other hand, are fundamental to Python. They are used everywhere. 
> Python is, in a very real sense, built on dicts, not sets. You can 
> implement sets starting from dicts, but not the other way around: dicts 
> are more fundamental than sets.

Fine, dicts are more fundamental. I just don't see that as such a big
argument against using a different literal for the empty dictionary
than was used in python2 and using {} to indicate the empty set. I
would have preferred it that way, but I don't consider it a big deal.

I just consider the arguments weak for those who seem to argue that
using {} for an empty dictionary in python3 was as good as unavoidable.

Antoon Pardon

More information about the Python-list mailing list