Python 3.0 - is this true?

Duncan Booth duncan.booth at invalid.invalid
Sun Nov 9 13:09:16 CET 2008


Steven D'Aprano wrote:

>> Not sure how to transform it into a search key that is efficient and
>> reliable.
>
> Yes, that's a general problem. It's not always easy to convert a sort 
> comparison function into a key-based sort. I know that 99% of the time 
> key is the right way to do custom sorts, but what about the other 1%?
>
You can create a key object which holds onto the original object and
calls the comparison function each time two keys are compared. 
See
http://groups.google.com/group/comp.lang.python/browse_thread/thread/fc2bcc7f93a4dd1a/141be6780acd99d9




More information about the Python-list mailing list