Re:What's New in Python 3.11?
by paskozdilar on Monday June 27, 2022 @03:51AM
(#31891731)
> you have to also check that the index is in the list (instead of off the end) and that the value at the resulting index equals the value of interest to test containment
True. However, the hardest part of the binary search algorithm is implemented through bisect, so it still saves a lot of developer time.
(Of course, for a custom class you can just wrap it in a __contains__ method and then just use the “in” operator.)