Raymond Hettinger <[email protected]> added the comment:
-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'}
----------
nosy: +rhettinger
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue45054>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com