how can I sort a bunch of lists over multiple fields?

Lonnie Princehouse finite.automaton at gmail.com
Thu Apr 28 17:33:43 EDT 2005


> Likewise, the above is basically just an inefficient way of writing:
>
> def date_key(book):
>     return book.data
>
> def author_and_date_key(book):
>     return (author_key(book), date_key(book))

It's certainly more elegant, but I wanted to talk about the mechanics
of comparison functions =)

I don't know that it's more or less efficient in execution.  That
depends on a few factors.




More information about the Python-list mailing list