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

2006-09-11 Thread Fredrik Lundh
"Tor Erik" wrote: > I would be surprised if it is the naive: 2.4 and earlier uses that algorithm (but with a better implementation). And "naive" isn't really the right word here; on average, a brute force search is pretty good for the find/index/in use case. Most fancy algorithms ignore the se

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

2006-09-09 Thread Alex Martelli
Tor Erik <[EMAIL PROTECTED]> wrote: > Alex Martelli wrote: > > Tor Erik <[EMAIL PROTECTED]> 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 >

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

2006-09-09 Thread Tor Erik
Alex Martelli wrote: > Tor Erik <[EMAIL PROTECTED]> 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 source

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

2006-09-09 Thread Marc 'BlackJack' Rintsch
In <[EMAIL PROTECTED]>, Tor Erik wrote: > I would be surprised if it is the naive: Why? I guess it simply calls an appropriate C library function. Ciao, Marc 'BlackJack' Rintsch -- http://mail.python.org/mailman/listinfo/python-list

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

2006-09-09 Thread Alex Martelli
Tor Erik <[EMAIL PROTECTED]> 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