Re: [Python-ideas] dictionary constructor should not allow duplicate keys
May 4, 2016
8:16 a.m.
On May 4, 2016 2:47 AM, "Pavol Lisy" <pavol.lisy@gmail.com> wrote:
2016-05-04 6:03 GMT+02:00, Nick Coghlan <ncoghlan@gmail.com>:
I was curious as to whether or not it was technically feasible to implement this "duplicate keys" check solely for dict displays in CPython without impacting other dict use cases, and it turns out it should be.
[...]
1. Report a DeprecationWarning in 3.6 2. Report a [RuntimeError? ValueError?] in 3.7+
But what about SyntaxError instead of RuntimeError? Could it be easily done too?
Is it really a SyntaxError? The compiler knows what the source code means, but it assumes that the meaning is not what you intended.
3189
Age (days ago)
3189
Last active (days ago)
0 comments
1 participants
participants (1)
-
Franklin? Lee