[Tutor] Sorting a dictionary in one line?

Terry Carroll carroll@tjc.com
Sun Jan 19 22:33:02 2003


On Sun, 19 Jan 2003, Magnus Lycka wrote:

> At 12:56 2003-01-19 -0800, Terry Carroll wrote:
>
> >I want to print a dictionary, sorted by key.   This works:
>
> [Conventional method (why do it differently?) snipped.]

Thanks, Magnus.  On the "why do it differently", a few reasons.

First, I didn't know that that was the conventional method; it's just what
I ended up with.  I guess that I should be pleased that what I ended up
with was conventional!

Second, this is a learning exercise.  If I can learn other ways of
performing the task, or gain insight into the language in the process of
trying, that's the point of the exercise.

Finally, if there was a more concise way of doing it and I was missing it,
I wanted to know what it was.

Thanks again!


-- 
Terry Carroll        |
Santa Clara, CA      |   "The parties are advised to chill."
carroll@tjc.com      |       - Mattel, Inc. v. MCA Records, Inc.,
Modell delendus est  |         no. 98-56577 (9th Cir. July 24, 2002)