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

--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to