[issue16385] evaluating literal dict with repeated keys gives no warnings/errors

Lukas Lueg report at bugs.python.org
Fri Nov 2 16:27:27 CET 2012


Lukas Lueg added the comment:

This could be avoided by


lives_in_init = (('lion': ['Africa', 'America']), ('lion': ['Europe']))
lives_in = {}
for k, v in lives_in_init:
    assert k not in lives_in
    lives_in[k] = v
del lives_in_init

Which is fast enough if executed only during module-loading

----------
nosy: +ebfe

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue16385>
_______________________________________


More information about the Python-bugs-list mailing list