<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Wed, May 4, 2016 at 12:04 AM Nick Coghlan <<a href="mailto:ncoghlan@gmail.com">ncoghlan@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">As such, the technical change being requested here (at least for<br>
CPython), is that BUILD_MAP be updated to do a PyDict_Contains() check prior to each key insertion, and:<br>1. Report a DeprecationWarning in 3.6<br>
2. Report a [RuntimeError? ValueError?] in 3.7+<br></blockquote><div><br></div><div>To be clear, this implementation would potentially raise an error in the random example -- ``{random(): 0, random(): 1}`` -- correct? <span style="line-height:1.5">If so, then code smell or not, I think that's too much breakage.</span></div><div><span style="line-height:1.5"><br></span></div><div>We could restrict the PyDict_Contains() call to only enforcing uniqueness of string or numeric literals, but then we'd still have some oddball situations:</div><div><br></div><div>def a():</div><div> return 'a'</div><div><span style="line-height:1.5"><br></span></div><div><span style="line-height:1.5">{a(): 0, 'a': 1}</span></div></div></div>