This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author shreyanavigyan
Recipients shreyanavigyan
Date 2021-05-04.16:51:35
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1620147095.86.0.59311867828.issue44033@roundup.psfhosted.org>
In-reply-to
Content
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 there two keys with the same name or that Python will add "x" : "First value" and will skip "x" : "Second value". But the result is opposite,

>>> d
{'x': 'Second value', 'y': 'Third value'}

Is this a bug or is this an intended behavior? (I may have missed out information related to this in the documentation. Kindly correct me if that's the case.)
History
Date User Action Args
2021-05-04 16:51:35shreyanavigyansetrecipients: + shreyanavigyan
2021-05-04 16:51:35shreyanavigyansetmessageid: <1620147095.86.0.59311867828.issue44033@roundup.psfhosted.org>
2021-05-04 16:51:35shreyanavigyanlinkissue44033 messages
2021-05-04 16:51:35shreyanavigyancreate