[issue16385] evaluating literal dict with repeated keys gives no warnings/errors
Jonathan Fine
report at bugs.python.org
Mon Mar 11 11:46:12 EDT 2019
Jonathan Fine <jfine2358 at gmail.com> added the comment:
This is was closed and tagged as resolved in 2012. The status has not been changed since then.
Using dict(a=1, ...) provides a workaround, but only when the keys are valid as variable names. The general workaround is something like
helper([
(1, 'a'),
(2, 'b'),
#etc
])
The helper is necessary:
>>> [(1, 2)] * 5
[(1, 2), (1, 2), (1, 2), (1, 2), (1, 2)]
>>> dict([(1, 2)] * 5)
{1: 2}
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue16385>
_______________________________________
More information about the Python-bugs-list
mailing list