Based on everything that I have seen bisect.bisect
and bisect.bisect_right
in Python seem to do the same thing. Is there any difference that accounts for the difference in name, or do they have identical behavior and merely a different name?
Obviously bisect.bisect_left
is different from both of them, but both bisect
and bisect_right
seem to always return the rightmost position where insertion of the element would maintain a sorted order.
They are identical:
>>> import bisect
>>> bisect.bisect is bisect.bisect_right
True
In case you were curious, bisect_right
is the original function and bisect
is the alias:
>>> bisect.bisect.__name__
'bisect_right'
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With