How do I sort these?

Alex Martelli aleaxit at yahoo.com
Fri Oct 28 22:56:36 EDT 2005


Paul Rubin <http://phr.cx@NOSPAM.invalid> wrote:

> "KraftDiner" <bobrien18 at yahoo.com> writes:
> > In C++ you can specify a comparision method, how can I do this with
> > python...
> 
> Yes, see the docs.  Just pass a comparison func to the sort method.

Or, better, pass a key-extraction function, that's much handier and
faster (it automates the "decorate-sort-undecorate", DSU, idiom).


Alex



More information about the Python-list mailing list