What algorithm does Python use to evaluate: if substring in string

Tor Erik torerik81 at gmail.com
Sat Sep 9 17:07:55 CEST 2006


Alex Martelli wrote:
> Tor Erik <torerik81 at gmail.com> wrote:
> 
>> I would be surprised if it is the naive:
> 
> Yep -- it's "a mix between Boyer-Moore and Horspool with a few more
> bells and whistles on the top", as documented and implemented in
> Objects/stringlib/fastsearch.h in the Python sources and well discussed
> and explained at http://effbot.org/zone/stringlib.htm .
> 
> 
> Alex
>  

Ok. Two questions:

1. Is "a in b" simply an alias for "b.find(a)"?

2. Is this algorithm exclusive to Python 2.5, or is it contained in 2.4 
aswell?



More information about the Python-list mailing list