[Tutor] Sort dictionaries

David Holland davholla2002 at yahoo.co.uk
Mon Nov 15 21:30:44 CET 2004


Is there a built command to sort a dictionary keys or
values by their length or do I have to write a
function to do it myself ?

David
 --- tutor-request at python.org wrote: 
> Send Tutor mailing list submissions to
> 	tutor at python.org
> 
> To subscribe or unsubscribe via the World Wide Web,
> visit
> 	http://mail.python.org/mailman/listinfo/tutor
> or, via email, send a message with subject or body
> 'help' to
> 	tutor-request at python.org
> 
> You can reach the person managing the list at
> 	tutor-owner at python.org
> 
> When replying, please edit your Subject line so it
> is more specific
> than "Re: Contents of Tutor digest..."
> 
> 
> Today's Topics:
> 
>    1. Re: object orientation (Kent Johnson)
>    2. Fwd: [Tutor] Python interpreter with command
> history?  (Max Noel)
>    3. Can anybody explain this unusual behavior?
> Apparent	variable
>       corruption? (R. Alan Monroe)
>    4. What is "distutils"? (Johan Geldenhuys)
>    5. Re: demon / app I/F better way ? (Lloyd Kvam)
>    6. Re: Function calls (Danny Yoo)
>    7. Re: Can anybody explain this unusual behavior?
> Apparent
>       variable corruption? (Bob Gailer)
>    8. Re: object orientation (Terry Carroll)
>    9. Re: What is "distutils"? (Dick Moores)
> 
> 
>
----------------------------------------------------------------------
> 
> Message: 1
> Date: Mon, 15 Nov 2004 06:06:25 -0500
> From: Kent Johnson <kent37 at tds.net>
> Subject: Re: [Tutor] object orientation
> To: tutor at python.org
> Message-ID: <41988DB1.8030602 at tds.net>
> Content-Type: text/plain; charset=ISO-8859-1;
> format=flowed
> 
> There was recently a long thread on this topic on
> comp.lang.python. Many 
> people argued that this is a desirable feature of
> python, not an 
> historical accident, because it lets the runtime try
> different methods 
> to resolve an operation. This post by Alex Martelli
> spells out the 
> argument at length: 
>
http://groups.google.com/groups?hl=en&lr=&c2coff=1&selm=1gm05gb.1251x8o3h0barN%25aleaxit%40yahoo.com&rnum=6
> 
> Kent
> 
> 
> Christian Meesters wrote:
> > Hi
> > 
> > These days I was reading a discussion between
> "Ruby-people" and 
> > "Python-people" (us) on pros and cons of each
> language. Such discussions 
> > aren't very meaningful, of course, but sometimes
> interesting. One of the 
> > arguments was about the realization of the
> OO-approach in the languages. 
> > And this leads me to my question: Though I like
> the Python syntax and 
> > actually prefer it above Ruby's, I wanted to know
> why we write len(x) 
> > instead of x.len() (x being a string for
> instance). Does anybody know an 
> > essay / link about why this approach was chosen?
> It makes sense within 
> > Python, of course, but for now I'm merely
> interested in the history. My 
> > own screenings of the web didn't bring up anything
> useful about this topic.
> > 
> > Thanks in advance,
> > Cheers
> > Christian
> > 
> > _______________________________________________
> > Tutor maillist  -  Tutor at python.org
> > http://mail.python.org/mailman/listinfo/tutor
> > 
> 
> 
> ------------------------------
> 
> Message: 2
> Date: Mon, 15 Nov 2004 12:15:37 +0000
> From: Max Noel <maxnoel_fr at yahoo.fr>
> Subject: Fwd: [Tutor] Python interpreter with
> command history? 
> To: Python Tutor List <tutor at python.org>
> Message-ID:
> <0EE63798-3700-11D9-A720-000393CBC88E at yahoo.fr>
> Content-Type: text/plain; charset=US-ASCII;
> format=flowed
> 
> 
> 
> Begin forwarded message:
> 
> > From: Christopher rasch <crasch at openknowledge.org>
> > Date: November 15, 2004 06:06:46 GMT
> > To: Max Noel <maxnoel_fr at yahoo.fr>
> > Subject: Re: [Tutor] Python interpreter with
> command history?
> >
> > Hi
> > On Nov 14, 2004, at 10:54 PM, Max Noel wrote:
> >
> >>
> >> On Nov 15, 2004, at 03:40, Christopher rasch
> wrote:
> >>
> >>> The default Python interpreter on Mac OS X
> doesn't seem to have a 
> >>> command history (such as you get in bash or
> tcsh).  Any ideas how to 
> >>> turn such a thing on?  The python documentation
> says that some 
> >>> interpreters have such a feature, but I haven't
> yet been able to 
> >>> locate a command line interpreter with such a
> feature.   Anyone 
> >>> recommend alternative interpreters?
> >>>
> >>> Thanks for any suggestions!
> >>>
> >>> Chris
> >>
> >> 	Go there:
>
http://homepages.cwi.nl/~jack/macpython/download.html
> >> 	Download the "MacPython for Panther addons" disk
> image. Install the 
> >> software it contains. Among this is a Package
> Manager. Launch it, 
> >> then use it to install the GNU Readline-related
> enhancements. Your 
> >> Python interactive interpreter should now have
> command history.
> >> 	I never understood why Apple hadn't included is
> in their standard 
> >> distribution (because of this, the same problem
> exists with irb)...
> >>
> >> -- Max
> >> maxnoel_fr at yahoo dot fr -- ICQ #85274019
> >> "Look at you hacker... A pathetic creature of
> meat and bone, panting 
> >> and sweating as you run through my corridors...
> How can you challenge 
> >> a perfect, immortal machine?"
> >>
> >>
> >
> > Hi Max,
> >
> > Thanks!  I did as you instructed, and installed
> the "MacPython for 
> > Panther addons" .  However, when I tried to launch
> the PackageManager, 
> > it appeared to start to launch, then immediately
> shut down.  Same with 
> > the other applications.  I'm guessing it's a
> permissions problem, but 
> > I'm not sure what I should change if that's the
> case.
> >
> > Any ideas?
> >
> > Thanks!
> >
> > Chris
> >
> >
> -- 
> maxnoel_fr at yahoo dot fr -- ICQ #85274019
> "Look at you hacker... A pathetic creature of meat
> and bone, panting 
> and sweating as you run through my corridors... How
> can you challenge a 
> perfect, immortal machine?"
> 
> 
> 
> ------------------------------
> 
> Message: 3
> Date: Mon, 15 Nov 2004 08:40:12 -0500
> From: "R. Alan Monroe" <amonroe at columbus.rr.com>
> 
=== message truncated === 


		
___________________________________________________________ 
Win a castle for NYE with your mates and Yahoo! Messenger 
http://uk.messenger.yahoo.com


More information about the Tutor mailing list