why not bisect options?

Robert Bossy Robert.Bossy at jouy.inra.fr
Tue Mar 4 12:36:02 EST 2008


Aaron Watters wrote:
> On Feb 29, 9:31 am, Robert Bossy <Robert.Bo... at jouy.inra.fr> wrote:
>   
>> Hi all,
>>
>> I thought it would be useful if insort and consorts* could accept the
>> same options than list.sort, especially key and cmp.....
>>     
>
> Wouldn't this make them slower and less space efficient?  It would
> be fine to add something like this as an additional elaboration, but
> I want bisect to scream as fast as possible in the default streamlined
> usage.
Yes it is slower and bigger, so I agree that the canonical 
implementation for default values should be kept. Also because the 
original bisect functions are actually written in C, the speed 
difference is even more noticeable.

Though, I needed custom ordering bisects since I was implementing 
interval trees (storing intervals by startpoint/endpoint).

Cheers,
RB



More information about the Python-list mailing list