<div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">On Tue, Dec 19, 2017 at 8:14 AM, Barry Warsaw <span dir="ltr"><<a href="mailto:barry@python.org" target="_blank">barry@python.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><span class="gmail-">On Dec 18, 2017, at 22:37, Nathaniel Smith <<a href="mailto:njs@pobox.com">njs@pobox.com</a>> wrote:<br>
<br>
> Wait, what? Why would changing pprint (so that it accurately reflects<br>
> dict's new underlying semantics!) be a breaking change? Are you<br>
> suggesting it shouldn't be changed in 3.7?<br>
<br>
</span>As others have pointed out, exactly because the current behavior is documented. And we all know that if it’s documented (and often even if it’s not, but that’s besides the point here) it will be relied upon.<br></blockquote><div><br></div>Nathaniel Smith has pointed out that  <font face="monospace, monospace">eval(pprint(a_dict))</font> is supposed to return the same dict -- so documented behavior may already be broken.</div><div class="gmail_quote"><br></div><div class="gmail_quote">(though I assume order is still ignored when comparing dicts, so: <span style="font-family:monospace,monospace">eval(pprint(a_dict)) == a_dict </span>will still hold.</div><div class="gmail_quote"><br></div><div class="gmail_quote">But practicality beats purity, and a number of folks have already posted use-cases where they rely on sorted order, so there you go.<br><div> <br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">
So we can’t change the default behavior. But I have no problems conceptually with giving users options. The devil is in the details though, e.g. should we special case dictionary sorting only? </blockquote><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">Should we use a sort `key` to mirror sorted() and list.sort()?<br></blockquote><div><br></div><div>That would be a nice feature! If anything is done, I think we should allow a key function.</div><div><br></div><div>and maybe have key=None as "unsorted"</div><div><br></div><div>-CHB</div><div><br></div><div><br></div><div><br></div><div><br></div></div>-- <br><div class="gmail_signature"><br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&R       (206) 526-6959  voice<br>7600 Sand Point Way NE   (206) 526-6329  fax<br>Seattle, WA  98115     (206) 526-6317  main reception<br><br><a href="mailto:Chris.Barker@noaa.gov" target="_blank">Chris.Barker@noaa.gov</a></div>
</div></div>