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

4 May
2016
4 May
'16
1: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.
[...]
- Report a DeprecationWarning in 3.6
- 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.
2585
Age (days ago)
2585
Last active (days ago)
0 comments
1 participants
participants (1)
-
Franklin? Lee