[Python-ideas] dictionary constructor should not allow duplicate keys
michael.selik at gmail.com
Wed May 4 23:01:00 EDT 2016
On Wed, May 4, 2016 at 10:40 PM Rob Cliffe <rob.cliffe at btinternet.com>
> The OP mentioned (even if he didn't explicitly produce it,
> understandable if it was very long) a real-life use case where a
> warning/error would have aided debugging.
> I find this case realistic.
Certainly was. But it occurs relatively rarely and can be solved with
linters and by stylistic changes like alphabetizing dict literals by key.
Can anyone produce a single real-life use case where repeated literal
> keys needed to be accepted without a warning or error?
> Here I'm throwing down the gauntlet to those who theorise about what
> (breakable) code *might* be out in the wild, and asking them to produce
> just one real-life case.
I thought Paul Moore gave a good example. You can see him and Ethan Furman
discussing it in a fork of this thread. There were a few code-generator
examples. Were these not realistic enough?
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-ideas