Re: display of dicts?

Chris Barker <[email protected]> Tue, 19 Dec 2017 09:55:34 -0800
Newsgroups gmane.comp.python.ipython.devel
Message-ID <CALGmxEKFr_Jb28peJPGnNV=KdzpqyESFUi5hyPtPbsXceWPm7w@mail.gmail.com>
--===============3224275926815100324==
Content-Type: multipart/alternative; boundary="94eb2c11a824e3abd40560b52e47"

--94eb2c11a824e3abd40560b52e47
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

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 dic=
t 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

--=20

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]

--94eb2c11a824e3abd40560b52e47
Content-Type: text/html; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable

<div dir=3D"ltr"><div class=3D"gmail_extra"><div class=3D"gmail_quote">On T=
ue, Dec 19, 2017 at 9:50 AM, Steve Holden <span dir=3D"ltr">&lt;<a href=3D"=
mailto:[email protected]" target=3D"_blank">[email protected]</a>&gt;</=
span> wrote:<br><blockquote class=3D"gmail_quote" style=3D"margin:0px 0px 0=
px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir=
=3D"ltr"><span class=3D"gmail-"><div style=3D"font-size:small"><br></div></=
span><div class=3D"gmail_extra"><div class=3D"gmail_quote"><div style=3D"fo=
nt-size:small">=E2=80=8BWhat about adding a &quot;sorted&quot; method to di=
cts that produces a dict with the same keys but the keys inserted =E2=80=8B=
in sorted order?</div></div></div></div></blockquote><div><br></div><div>Th=
at would be a job for 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 the plain sorted() function only gives you the keys.. th=
ough there is=C2=A0</div><div><br></div><div>







<p class=3D"gmail-p1" style=3D"margin:0px;font-style:normal;font-variant:no=
rmal;font-weight:normal;font-stretch:normal;font-size:11px;line-height:norm=
al;font-family:Menlo;color:rgb(0,0,0);background-color:rgb(255,255,255)"><s=
pan class=3D"gmail-s1" style=3D"font-variant-ligatures:no-common-ligatures;=
color:rgb(52,163,39)">dict</span><span class=3D"gmail-s2" style=3D"font-var=
iant-ligatures:no-common-ligatures">(</span><span class=3D"gmail-s1" style=
=3D"font-variant-ligatures:no-common-ligatures;color:rgb(52,163,39)">sorted=
</span><span class=3D"gmail-s2" style=3D"font-variant-ligatures:no-common-l=
igatures">(d.items()))</span></p><p class=3D"gmail-p1" style=3D"margin:0px;=
font-style:normal;font-variant:normal;font-weight:normal;font-stretch:norma=
l;font-size:11px;line-height:normal;font-family:Menlo;color:rgb(0,0,0);back=
ground-color:rgb(255,255,255)"><span class=3D"gmail-s2" style=3D"font-varia=
nt-ligatures:no-common-ligatures"><br></span></p><p class=3D"gmail-p1" styl=
e=3D"margin:0px;font-variant-numeric:normal;font-variant-east-asian:normal;=
font-stretch:normal;line-height:normal">to get a sorted dict.<span style=3D=
"color:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-styl=
e:normal;font-variant-ligatures:normal;font-variant-caps:normal;font-weight=
:normal;background-color:rgb(255,255,255)">=C2=A0</span><br></p><p class=3D=
"gmail-p1" style=3D"margin:0px;font-variant-numeric:normal;font-variant-eas=
t-asian:normal;font-stretch:normal;line-height:normal"><span style=3D"color=
:rgb(34,34,34);font-family:arial,sans-serif;font-size:small;font-style:norm=
al;font-variant-ligatures:normal;font-variant-caps:normal;font-weight:norma=
l;background-color:rgb(255,255,255)"><br></span></p><p class=3D"gmail-p1" s=
tyle=3D"margin:0px;font-variant-numeric:normal;font-variant-east-asian:norm=
al;font-stretch:normal;line-height:normal"><span style=3D"color:rgb(34,34,3=
4);font-family:arial,sans-serif;font-size:small;font-style:normal;font-vari=
ant-ligatures:normal;font-variant-caps:normal;font-weight:normal;background=
-color:rgb(255,255,255)">-CHB</span></p></div></div><div class=3D"gmail_ext=
ra"><br></div>-- <br><div class=3D"gmail_signature"><br>Christopher Barker,=
 Ph.D.<br>Oceanographer<br><br>Emergency Response Division<br>NOAA/NOS/OR&a=
mp;R =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0(206) 526-6959=C2=A0=C2=A0 vo=
ice<br>7600 Sand Point Way NE =C2=A0=C2=A0(206) 526-6329=C2=A0=C2=A0 fax<br=
>Seattle, WA =C2=A098115 =C2=A0 =C2=A0 =C2=A0=C2=A0(206) 526-6317=C2=A0=C2=
=A0 main reception<br><br><a href=3D"mailto:[email protected]" target=
=3D"_blank">[email protected]</a></div>
</div></div>

--94eb2c11a824e3abd40560b52e47--

--===============3224275926815100324==
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

--===============3224275926815100324==--