Message406302
-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'} |
|
Date |
User |
Action |
Args |
2021-11-14 01:10:43 | rhettinger | set | recipients:
+ rhettinger, bob.ippolito, corona10, Zeturic, andrei.avk |
2021-11-14 01:10:43 | rhettinger | set | messageid: <1636852243.15.0.654490799388.issue45054@roundup.psfhosted.org> |
2021-11-14 01:10:43 | rhettinger | link | issue45054 messages |
2021-11-14 01:10:42 | rhettinger | create | |
|