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

Michael Selik michael.selik at gmail.com
Wed May 4 00:40:16 EDT 2016

On Wed, May 4, 2016 at 12:19 AM Random832 <random832 at fastmail.com> wrote:

> On Tue, May 3, 2016, at 23:31, Chris Angelico wrote:
> > Duplicate keys in dict display
> > is more similar to duplicate keyword arguments in a function call than
> > to reassignment.
> If we can blithely pass the same constant key twice to BUILD_MAP, why
> *shouldn't* we be able to do the same to CALL_FUNCTION?

Because keyword arguments can only be valid identifiers, rather than
expressions. There's absolutely no reason to use the same identifier as
keyword twice, but there could be some oddball reasons to use the same
expression as dict key twice.

[I know I've said that before, but it's a long thread. My apologies if
you'd already read that.]
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20160504/d345d949/attachment-0001.html>

More information about the Python-ideas mailing list