sorting on keys in a list of dicts

It's me itsme at
Fri Jan 7 11:26:55 EST 2005

What does it mean by "stability in sorting"?

Can somebody please give a sample for using the code posted?  I am a little
lost here and I like to know more about the use of keys....


"Nick Coghlan" <ncoghlan at> wrote in message
news:mailman.298.1105112062.22381.python-list at
> Jeff Shannon wrote:
> > I suppose that your version has the virtue that, if the sortkey value is
> > equal, items retain the order that they were in the original list,
> > whereas my version will sort them into an essentially arbitrary order.
> >  Is there anything else that I'm missing here?
> Stability in sorting is a property not to be sneezed at - it means
switching to
> sorting by a second key gives the effect of "sort by key 1, then by key
> whereas that doesn't hold with an unstable sort algorithm. If you've ever
> an application with an unstable sorting process and that only allows
sorting a
> table on one column at a time, you'll appreciate the frustration that can
cause :)
> Also, it's required to match the behaviour of the Python 2.4 version
(which gets
> to take advantage of the stability of the builtin sort).
> Cheers,
> Nick.
> -- 
> Nick Coghlan   |   ncoghlan at   |   Brisbane, Australia
> ---------------------------------------------------------------

More information about the Python-list mailing list