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

David Mertz mertz at gnosis.cx
Wed May 4 15:28:26 EDT 2016

On May 4, 2016 10:59 AM, "Michael Selik" <michael.selik at gmail.com> wrote:
> On Wed, May 4, 2016, 1:37 PM Luigi Semenzato <luigi at semenzato.com> wrote:
>> read dictionaries in the code---by a human.  Except that with these
>> semantics it makes it impossible to detect duplicate key errors, which
>> the vast majority of users would prefer to notice (a bold and unproven
>> statement, but a reasonable guess).
> I'm part of the minority(?) that doesn't care. I hope that helps adjust
your odds ratio for that guess.

I'm also part of that group (I question whether it is minority) who wishes
to allow duplicate keys at the syntax level, but to let linters complain.
While *most* duplicate literal keys in dict displays probably are bugs, the
legitimate and intended uses are not rare enough to prohibit them
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160504/fdc06dd3/attachment.html>

More information about the Python-ideas mailing list