[issue44033] Adding multiple keys of the same name to a dict doesn't raise an exception

2021-05-04 Thread Shreyan Avigyan
Shreyan Avigyan added the comment: Ok. I'm closing this then. (I wasn't aware that this was an intended behavior.) -- ___ Python tracker ___ __

[issue44033] Adding multiple keys of the same name to a dict doesn't raise an exception

2021-05-04 Thread Shreyan Avigyan
Change by Shreyan Avigyan : -- resolution: -> not a bug stage: -> resolved status: open -> closed ___ Python tracker ___ ___ Pytho

[issue44033] Adding multiple keys of the same name to a dict doesn't raise an exception

2021-05-04 Thread Jelle Zijlstra
Jelle Zijlstra added the comment: Looks like the same issue to me as the rejected issue that Karthikeyan mentioned. Changing it to use the first value is a non-starter because it would break compatibility. I'd suggest using a linter that warns about duplicate keys in literals; we implemented

[issue44033] Adding multiple keys of the same name to a dict doesn't raise an exception

2021-05-04 Thread Shreyan Avigyan
Shreyan Avigyan added the comment: I've read that issue but it seems that it actually was based on "Should there be a warning or error?". I actually suggest something different. I suggest that "Either raise an exception or just use the first key-value pair if the key is repeated during initi

[issue44033] Adding multiple keys of the same name to a dict doesn't raise an exception

2021-05-04 Thread Karthikeyan Singaravelan
Karthikeyan Singaravelan added the comment: Looks like a duplicate of https://bugs.python.org/issue16385 -- nosy: +xtreak ___ Python tracker ___ __

[issue44033] Adding multiple keys of the same name to a dict doesn't raise an exception

2021-05-04 Thread Shreyan Avigyan
New submission from Shreyan Avigyan : Adding multiple keys of the same name to a dict should raise an exception but instead causes a different behavior. For example consider this code, >>> d = {"x" : "First value", "x" : "Second value", "y" : "Third value"} One would expect a error because th