<div dir="ltr">After following the long thread, I'm solidly -1, at least on an error. A warning wouldn't be so bad, but would still feel like a nuisance not a feature. Such a warning should belong to linters, not to the language itself. Use those to automatically catch statically detectible probably-bad patterns like duplicate literals as keys of dictionary displays.<div><br></div><div>The thing that nudged me to -1 is code something like the following, which I've actually written for completely valid use-cases:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="monospace, monospace">def code_generate(data_source, output=open('data.py','w')):</font></div><div><font face="monospace, monospace"> """Write data to loadable Python module</font></div><div><font face="monospace, monospace"><br></font></div></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="monospace, monospace"> data_source may contain multiple occurrences of each key.</font></div></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="monospace, monospace"> Later occurrences are "better" than earlier ones </font></div></blockquote><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div><font face="monospace, monospace"> """</font></div><div><font face="monospace, monospace"> print("data = {", file=output)</font></div><div><font face="monospace, monospace"> for key, val in data_source:</font></div><div><font face="monospace, monospace"> print(" %s: %s," % (key, val), file=output)</font></div><div><font face="monospace, monospace"> print("}", file=output)</font></div></blockquote><div> <br><div class="gmail_extra">I really don't want the Python interpreter to complain about my perfectly valid 'data.py' module that I auto-generated knowing full well it might have duplicate literal keys. Yes, of course I could write a more complex function that explicitly pruned keys if they were duplicates before writing to 'data.py'. But I do not want to have to think about that when a well defined semantics of Python since version 0.9 does not require that extra work.</div><div class="gmail_extra"><br><div class="gmail_quote">On Wed, May 4, 2016 at 4:56 AM, M.-A. Lemburg <span dir="ltr"><<a href="mailto:mal@egenix.com" target="_blank">mal@egenix.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Issuing a warning for this would probably help, but raising<br>
an error introduced a backwards incompatibility which is<br>
not warranted IMO, given how seldom such situations occur in<br>
practice.<br></blockquote></div><br clear="all"><div><br></div>-- <br><div class="gmail_signature">Keeping medicines from the bloodstreams of the sick; food <br>from the bellies of the hungry; books from the hands of the <br>uneducated; technology from the underdeveloped; and putting <br>advocates of freedom in prisons. Intellectual property is<br>to the 21st century what the slave trade was to the 16th.<br></div>
</div></div></div>