[FRPythoneers] sorting a list of dictionaries

Andrew Diederich diederic at boulder.net
Tue Jan 21 15:33:04 MST 2003

On Tue, 21 Jan 2003, Uche Ogbuji wrote:

> I'm sorry I haven't had time to follow this thread clearly, but in case it's 
> handy, I wanted to point out that any time you are tempted to use sort() with 
> a function argument, and performance is an issue, you want to at least 
> consider the DSU pattern.  See:
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/52234
> I think they use list comprehension examples, but DSU can be mplemented using 
> map and lambda as well, for 1.5.2 support.
> I do recomment moving to Python 2.2. ASAP, though.  Ther are wonderful 
> additions and improvements.

Thanks for the tip.  I'll look there if speed becomes an issue.  The
result set is tiny right now (well under a hundred items) so it works
pretty well.

I've used python 2.2 (maybe 2.1) for some XML scripts previously.  I would
have used it here, but it was easier to use the 1.5.2 version that had
ldap working, then shoehorn in 2.2 and find the ldap support and make that
go.  It's a SuSE 6.4 linux box that has just been happilly running, and
hasn't given me enough reason to reformat it.

Thanks again,


More information about the FRPythoneers mailing list