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 rhettinger
Recipients Zeturic, andrei.avk, bob.ippolito, corona10, rhettinger
Date 2021-11-14.01:10:42
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1636852243.15.0.654490799388.issue45054@roundup.psfhosted.org>
In-reply-to
Content
-0 on doing this. The suggested warning/error adds overhead that everyone would pay for but would almost never be of benefit.  I haven't seen this particular problem arise in practice.  The likely reasons it doesn't come up are 1) that generated data doesn't normally produce mixed type keys, 2) because mixed type keys don't round-trip, and 3) even using numeric keys only (not mixed) is uncommon because it results in poor outcomes that fail round-trip invariants.

Andrei Kulakov is right in saying that such data suggests deeper problems with the design and that static typing would be beneficial.

One last thought:  Even with regular dicts, we don't normally warn about encountering duplicate keys:

    >>> dict([(1, 'run'), (1, 'zoo'), (3, 'tree')])
    {1: 'zoo', 3: 'tree'}
History
Date User Action Args
2021-11-14 01:10:43rhettingersetrecipients: + rhettinger, bob.ippolito, corona10, Zeturic, andrei.avk
2021-11-14 01:10:43rhettingersetmessageid: <1636852243.15.0.654490799388.issue45054@roundup.psfhosted.org>
2021-11-14 01:10:43rhettingerlinkissue45054 messages
2021-11-14 01:10:42rhettingercreate