I was wondering if the \'find\' method on strings was implemented with a linear search, or if python did something more sophisticated. The Python documentation doesn\'t disc
Looks like the algorithm used originates from Boyer-Moore-Horspool algorithm
You should be able to find it in Objects/stringlib/find.h, although the real code is in fastsearch.h.
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