"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
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
>
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
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
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
I would be surprised if it is the naive:
m = 0
s1 = "me"
s2 = "locate me"
s1len = len(s1)
s2len = len(s2)
found = False
while m + s1len <= s2len:
if s1 == s2len[m:m+s1len]:
found = True
break
m += 1
--
http://mail.python.org/mailman/listinfo/python