Re: Incompatible change discussion: Pretty printing of ordered dict.
Carl Smith <[email protected]> Thu, 03 Aug 2017 16:38:39 +0000
| Newsgroups | gmane.comp.python.ipython.devel |
|---|---|
| Message-ID | <CAP-uhDc-vcnaigkiATAiRhHBZmzHqYtCeZEZmtLezxnwg7KN3Q@mail.gmail.com> |
--===============5408975623708630942== Content-Type: multipart/alternative; boundary="001a114ba7c2deb23e0555dc0396" --001a114ba7c2deb23e0555dc0396 Content-Type: text/plain; charset="UTF-8" I'm with Thomas. On Wed, 2 Aug 2017 22:30 Wes Turner, <[email protected]> wrote: > Maybe a SORT_DICT_KEYS bool configuration setting? Really practically only > in order to teach: > > - dict > - https://docs.python.org/3/tutorial/datastructures.html#dictionaries > - PYTHONHASHSEED / -R > - https://docs.python.org/3/using/cmdline.html#envvar-PYTHONHASHSEED > - https://docs.python.org/3/using/cmdline.html#cmdoption-R > - collections.OrderedDict (is backwards compatible) > - https://docs.python.org/3/library/collections.html#ordereddict-objects > > > > On Wednesday, August 2, 2017, Matthias Bussonnier < > [email protected]> wrote: > >> Hi all, >> >> As you may or may not be aware, with Python 3.6 the dictionary are >> ordered by default. It is technically an implementation detail, though >> some people would love for it not to. >> >> Regardless, IPython has for a long time pretty-printed the dictionary >> with _sorted_ keys, this thus prevent to teach python and show that >> dictionaries maintain order. Thus there is the question of wether we >> should disable sorting keys while pretty-printing. >> >> https://github.com/ipython/ipython/issues/10110 >> >> This seem like a minor change, but I'd like to know if some of you are >> _relying_ on the ordering of dict when they are printed, or have >> compelling arguments against (or for) removing sorting of the keys >> before pretty_printing. >> >> If you care about the above subject, please have your voice heard in >> above issue. >> >> Thanks, >> -- >> Matthias >> _______________________________________________ >> IPython-dev mailing list >> [email protected] >> https://mail.python.org/mailman/listinfo/ipython-dev >> > _______________________________________________ > IPython-dev mailing list > [email protected] > https://mail.python.org/mailman/listinfo/ipython-dev > --001a114ba7c2deb23e0555dc0396 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <p dir=3D"ltr">I'm with Thomas. </p> <br><div class=3D"gmail_quote"><div dir=3D"ltr">On Wed, 2 Aug 2017 22:30 We= s Turner, <<a href=3D"mailto:[email protected]">[email protected]<= /a>> wrote:<br></div><blockquote class=3D"gmail_quote" style=3D"margin:0= 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Maybe a SORT_DICT_KE= YS bool configuration setting? Really practically only in order to teach:<d= iv><br></div><div>- dict</div><div>=C2=A0 -=C2=A0<a href=3D"https://docs.py= thon.org/3/tutorial/datastructures.html#dictionaries" target=3D"_blank">htt= ps://docs.python.org/3/tutorial/datastructures.html#dictionaries</a></div><= div>-=C2=A0<span style=3D"color:rgb(34,34,34);font-family:Roboto-Regular,He= lveticaNeue,Arial,sans-serif;font-size:14px">PYTHONHASHSEED / -R</span></di= v><div><span style=3D"color:rgb(34,34,34);font-family:Roboto-Regular,Helvet= icaNeue,Arial,sans-serif;font-size:14px">=C2=A0 -=C2=A0</span><font color= =3D"#222222" face=3D"Roboto-Regular, HelveticaNeue, Arial, sans-serif"><spa= n style=3D"font-size:14px"><a href=3D"https://docs.python.org/3/using/cmdli= ne.html#envvar-PYTHONHASHSEED" target=3D"_blank">https://docs.python.org/3/= using/cmdline.html#envvar-PYTHONHASHSEED</a></span></font></div><div><font = color=3D"#222222" face=3D"Roboto-Regular, HelveticaNeue, Arial, sans-serif"= ><span style=3D"font-size:14px">=C2=A0 - <a href=3D"https://docs.python.org= /3/using/cmdline.html#cmdoption-R" target=3D"_blank">https://docs.python.or= g/3/using/cmdline.html#cmdoption-R</a></span></font></div><div><font color= =3D"#222222" face=3D"Roboto-Regular, HelveticaNeue, Arial, sans-serif"><spa= n style=3D"font-size:14px">- collections.OrderedDict (is backwards compatib= le)</span></font></div><div><span style=3D"color:rgb(34,34,34);font-family:= Roboto-Regular,HelveticaNeue,Arial,sans-serif;font-size:14px">=C2=A0 -=C2= =A0<a href=3D"https://docs.python.org/3/library/collections.html#ordereddic= t-objects" target=3D"_blank">https://docs.python.org/3/library/collections.= html#ordereddict-objects</a></span></div><div><font color=3D"#222222" face= =3D"Roboto-Regular, HelveticaNeue, Arial, sans-serif"><span style=3D"font-s= ize:14px"><br></span></font></div><div><font color=3D"#222222" face=3D"Robo= to-Regular, HelveticaNeue, Arial, sans-serif"><span style=3D"font-size:14px= "><br></span></font><br>On Wednesday, August 2, 2017, Matthias Bussonnier &= lt;<a href=3D"mailto:[email protected]" target=3D"_blank">busson= [email protected]</a>> wrote:<br><blockquote class=3D"gmail_quote" = style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi = all,<br> <br> As you may or may not be aware, with Python 3.6 the dictionary are<br> ordered by default. It is technically an implementation detail, though<br> some people would love for it not to.<br> <br> Regardless, IPython has for a long time pretty-printed the dictionary<br> with _sorted_ keys, this thus prevent to teach python and show that<br> dictionaries maintain order. Thus there is the question of wether we<br> should disable sorting keys while pretty-printing.<br> <br> <a href=3D"https://github.com/ipython/ipython/issues/10110" target=3D"_blan= k">https://github.com/ipython/ipython/issues/10110</a><br> <br> This seem like a minor change, but I'd like to know if some of you are<= br> _relying_ on the ordering of dict when they are printed, or have<br> compelling arguments against (or for) removing sorting of the keys<br> before pretty_printing.<br> <br> If you care about the above subject, please have your voice heard in<br> above issue.<br> <br> Thanks,<br> --<br> Matthias<br> _______________________________________________<br> IPython-dev mailing list<br> <a>[email protected]</a><br> <a href=3D"https://mail.python.org/mailman/listinfo/ipython-dev" target=3D"= _blank">https://mail.python.org/mailman/listinfo/ipython-dev</a><br> </blockquote></div> _______________________________________________<br> IPython-dev mailing list<br> <a href=3D"mailto:[email protected]" target=3D"_blank">IPython-dev@pyt= hon.org</a><br> <a href=3D"https://mail.python.org/mailman/listinfo/ipython-dev" rel=3D"nor= eferrer" target=3D"_blank">https://mail.python.org/mailman/listinfo/ipython= -dev</a><br> </blockquote></div> --001a114ba7c2deb23e0555dc0396-- --===============5408975623708630942== Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ IPython-dev mailing list [email protected] https://mail.python.org/mailman/listinfo/ipython-dev --===============5408975623708630942==--