Re: Incompatible change discussion: Pretty printing of ordered dict.
Thomas Kluyver <[email protected]> Wed, 2 Aug 2017 21:32:34 +0100
| Newsgroups | gmane.comp.python.ipython.devel |
|---|---|
| Message-ID | <CAOvn4qhiYtQX9-0++1PiBt+Rc1=Cs5Webzqqw3=WUFgiLtJW6w@mail.gmail.com> |
--===============3628902734361269009== Content-Type: multipart/alternative; boundary="94eb2c1cd052ce72b70555cb2b18" --94eb2c1cd052ce72b70555cb2b18 Content-Type: text/plain; charset="UTF-8" I don't have a particular concrete use case, but as an experienced Python programmer who knows that dicts are conceptually unordered, I like the sorted presentation and would be sorry to lose it. It makes it easier to quickly find something in a dict if its shown in alphabetical order. If the dict maintaining insertion order becomes a language feature rather than an implementation detail, I would favour showing that. But for now it's an implementation detail, so it shouldn't change how we think about dicts. Thomas On 2 August 2017 at 19:44, 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 > --94eb2c1cd052ce72b70555cb2b18 Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div><div>I don't have a particular concrete use case,= but as an experienced Python programmer who knows that dicts are conceptua= lly unordered, I like the sorted presentation and would be sorry to lose it= . It makes it easier to quickly find something in a dict if its shown in al= phabetical order.<br><br></div>If the dict maintaining insertion order beco= mes a language feature rather than an implementation detail, I would favour= showing that. But for now it's an implementation detail, so it shouldn= 't change how we think about dicts.<br><br></div>Thomas<br></div><div c= lass=3D"gmail_extra"><br><div class=3D"gmail_quote">On 2 August 2017 at 19:= 44, Matthias Bussonnier <span dir=3D"ltr"><<a href=3D"mailto:bussonnierm= [email protected]" target=3D"_blank">[email protected]</a>></= span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0 0 0 .8e= x;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" rel=3D"noreferr= er" target=3D"_blank">https://github.com/ipython/<wbr>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> <span class=3D"HOEnZb"><font color=3D"#888888">--<br> Matthias<br> ______________________________<wbr>_________________<br> IPython-dev mailing list<br> <a href=3D"mailto:[email protected]">[email protected]</a><br> <a href=3D"https://mail.python.org/mailman/listinfo/ipython-dev" rel=3D"nor= eferrer" target=3D"_blank">https://mail.python.org/<wbr>mailman/listinfo/ip= ython-dev</a><br> </font></span></blockquote></div><br></div> --94eb2c1cd052ce72b70555cb2b18-- --===============3628902734361269009== 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 --===============3628902734361269009==--