I want to know what is the search algorithm used for implementing the python in
operator. For example:
if num in some_large_list:
do_something(num)
I notice that it seems to be slow on large lists , what is the algorithmic complexity of the in
operator ? How does it scale with size of the list. Can we implement something better?
(I have asked how the in
operator has been implemented in python, what search algorithm it uses , and can we do something better than that for larger lists)