Re: display of dicts?
Steve Holden <[email protected]> Tue, 19 Dec 2017 17:58:15 +0000
| Newsgroups | gmane.comp.python.ipython.devel |
|---|---|
| Message-ID | <CAMofdRAUCFDtXT=PUp3pKkOn-8Z=VfaZBKUrsQqE48Wkwbs=Bg@mail.gmail.com> |
--===============4649166622318945045== Content-Type: multipart/alternative; boundary="001a114e364209f3590560b5360c" --001a114e364209f3590560b5360c Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable I've just "run it up the flagpole" on python-dev, so we'll see if anyone salutes. Steve Holden On Tue, Dec 19, 2017 at 5:55 PM, Chris Barker <[email protected]> wrote= : > On Tue, Dec 19, 2017 at 9:50 AM, Steve Holden <[email protected]> wrote= : > >> >> =E2=80=8BWhat about adding a "sorted" method to dicts that produces a di= ct with >> the same keys but the keys inserted =E2=80=8Bin sorted order? >> > > That would be a job for python-dev, yes? > > And maybe .sort() that sorts in place instead -- similar to lists. > > Too bad that the plain sorted() function only gives you the keys.. though > there is > > dict(sorted(d.items())) > > > to get a sorted dict. > > > -CHB > > -- > > Christopher Barker, Ph.D. > Oceanographer > > Emergency Response Division > NOAA/NOS/OR&R (206) 526-6959 voice > 7600 Sand Point Way NE (206) 526-6329 fax > Seattle, WA 98115 (206) 526-6317 main reception > > [email protected] > > _______________________________________________ > IPython-dev mailing list > [email protected] > https://mail.python.org/mailman/listinfo/ipython-dev > > --001a114e364209f3590560b5360c Content-Type: text/html; charset="UTF-8" Content-Transfer-Encoding: quoted-printable <div dir=3D"ltr"><div class=3D"gmail_default" style=3D"font-size:small">I&#= 39;ve just "run it up the flagpole" on python-dev, so we'll s= ee if anyone salutes.</div></div><div class=3D"gmail_extra"><br clear=3D"al= l"><div><div class=3D"gmail_signature" data-smartmail=3D"gmail_signature"><= div dir=3D"ltr">Steve Holden<br></div></div></div> <br><div class=3D"gmail_quote">On Tue, Dec 19, 2017 at 5:55 PM, Chris Barke= r <span dir=3D"ltr"><<a href=3D"mailto:[email protected]" target=3D"= _blank">[email protected]</a>></span> wrote:<br><blockquote class=3D= "gmail_quote" style=3D"margin:0 0 0 .8ex;border-left:1px #ccc solid;padding= -left:1ex"><div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_= quote"><span class=3D"">On Tue, Dec 19, 2017 at 9:50 AM, Steve Holden <span= dir=3D"ltr"><<a href=3D"mailto:[email protected]" target=3D"_blank">s= [email protected]</a>></span> wrote:<br><blockquote class=3D"gmail_quot= e" style=3D"margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204)= ;padding-left:1ex"><div dir=3D"ltr"><span class=3D"m_-175763144034294868gma= il-"><div style=3D"font-size:small"><br></div></span><div class=3D"gmail_ex= tra"><div class=3D"gmail_quote"><div style=3D"font-size:small">=E2=80=8BWha= t about adding a "sorted" method to dicts that produces a dict wi= th the same keys but the keys inserted =E2=80=8Bin sorted order?</div></div= ></div></div></blockquote><div><br></div></span><div>That would be a job fo= r python-dev, yes?</div><div><br></div><div>And maybe .sort() that sorts in= place instead -- similar to lists.</div><div><br></div><div>Too bad that t= he plain sorted() function only gives you the keys.. though there is=C2=A0<= /div><div><br></div><div> <p class=3D"m_-175763144034294868gmail-p1" style=3D"margin:0px;font-style:n= ormal;font-variant:normal;font-weight:normal;font-stretch:normal;font-size:= 11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);background-color= :rgb(255,255,255)"><span class=3D"m_-175763144034294868gmail-s1" style=3D"f= ont-variant-ligatures:no-common-ligatures;color:rgb(52,163,39)">dict</span>= <span class=3D"m_-175763144034294868gmail-s2" style=3D"font-variant-ligatur= es:no-common-ligatures">(</span><span class=3D"m_-175763144034294868gmail-s= 1" style=3D"font-variant-ligatures:no-common-ligatures;color:rgb(52,163,39)= ">sorted</span><span class=3D"m_-175763144034294868gmail-s2" style=3D"font-= variant-ligatures:no-common-ligatures">(d.items()))</span></p><p class=3D"m= _-175763144034294868gmail-p1" style=3D"margin:0px;font-style:normal;font-va= riant:normal;font-weight:normal;font-stretch:normal;font-size:11px;line-hei= ght:normal;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,= 255)"><span class=3D"m_-175763144034294868gmail-s2" style=3D"font-variant-l= igatures:no-common-ligatures"><br></span></p><p class=3D"m_-175763144034294= 868gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-variant-e= ast-asian:normal;font-stretch:normal;line-height:normal">to get a sorted di= ct.<span style=3D"color:rgb(34,34,34);font-family:arial,sans-serif;font-siz= e:small;font-style:normal;font-variant-ligatures:normal;font-variant-caps:n= ormal;font-weight:normal;background-color:rgb(255,255,255)">=C2=A0</span><b= r></p><p class=3D"m_-175763144034294868gmail-p1" style=3D"margin:0px;font-v= ariant-numeric:normal;font-variant-east-asian:normal;font-stretch:normal;li= ne-height:normal"><span style=3D"color:rgb(34,34,34);font-family:arial,sans= -serif;font-size:small;font-style:normal;font-variant-ligatures:normal;font= -variant-caps:normal;font-weight:normal;background-color:rgb(255,255,255)">= <br></span></p><p class=3D"m_-175763144034294868gmail-p1" style=3D"margin:0= px;font-variant-numeric:normal;font-variant-east-asian:normal;font-stretch:= normal;line-height:normal"><span style=3D"color:rgb(34,34,34);font-family:a= rial,sans-serif;font-size:small;font-style:normal;font-variant-ligatures:no= rmal;font-variant-caps:normal;font-weight:normal;background-color:rgb(255,2= 55,255)">-CHB</span></p></div></div><span class=3D""><div class=3D"gmail_ex= tra"><br></div>-- <br><div class=3D"m_-175763144034294868gmail_signature"><= br>Christopher Barker, Ph.D.<br>Oceanographer<br><br>Emergency Response Div= ision<br>NOAA/NOS/OR&R =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0<a href= =3D"tel:(206)%20526-6959" value=3D"+12065266959" target=3D"_blank">(206) 52= 6-6959</a>=C2=A0=C2=A0 voice<br>7600 Sand Point Way NE =C2=A0=C2=A0<a href= =3D"tel:(206)%20526-6329" value=3D"+12065266329" target=3D"_blank">(206) 52= 6-6329</a>=C2=A0=C2=A0 fax<br>Seattle, WA =C2=A098115 =C2=A0 =C2=A0 =C2=A0= =C2=A0<a href=3D"tel:(206)%20526-6317" value=3D"+12065266317" target=3D"_bl= ank">(206) 526-6317</a>=C2=A0=C2=A0 main reception<br><br><a href=3D"mailto= :[email protected]" target=3D"_blank">[email protected]</a></div> </span></div></div> <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> <br></blockquote></div><br></div> --001a114e364209f3590560b5360c-- --===============4649166622318945045== 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 --===============4649166622318945045==--