[Python-ideas] dictionary constructor should not allow duplicate keys

Guido van Rossum guido at python.org
Wed May 4 11:16:53 EDT 2016


All this discussion is certainly very educational for the participants, but
I want to remind everyone that this is not going to happen without a PEP.

Personally I'm -0 on the whole business. Some quick notes:

- In ABC, this was considered, and the rule was that {k1: v1; k2: v2} was
allowed to have k1==k2 as long as v1==v2. Otherwise it was an error. (But
ABC did not have comprehensions.)

- Franklin? brought up sets and suggested the same thing should happen
there. I'm not so sure though. When teaching Python it's nice to be able to
demonstrate the fundamental property of sets by showing it:

>>> {1, 1, 1}
{1}
>>>

-- 
--Guido van Rossum (python.org/~guido)
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160504/90d2e596/attachment.html>


More information about the Python-ideas mailing list