How is string.find implemented in CPython?
The comment on the implementation has the following to say:
fast search/count implementation, based on a mix between boyer-moore and horspool, with a few more bells and whistles on the top.
for some more background, see: http://effbot.org/zone/stringlib.htm
—https://github.com/python/cpython/blob/master/Objects/stringlib/fastsearch.h#L5
You should be able to find it in Objects/stringlib/find.h, although the real code is in fastsearch.h.