On Tue, 25 Mar 2014 08:21:19 -0400, Roy Smith wrote: > In article <mailman.8511.1395743071.18130.python-l...@python.org>, > Antoon Pardon <antoon.par...@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. 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. I'm sure it is awfully impressive that mathematicians can derive the laws of integer maths starting only from the empty set ∅, but as far as programming goes that's not a very useful thing. Dicts are much more important, and they are much more commonly used. -- Steven D'Aprano http://import-that.dreamwidth.org/ -- https://mail.python.org/mailman/listinfo/python-list