Possible Duplicate:
How is string.find implemented in CPython?
I have read many posts here in stack-overflow comparing the performance of sub-string search (e.g. Python string search efficiency, Is this the most efficient way to search for a substring?, substring in python, etc...)
I have also looked at the source code implementation of contains abstract.c.
As far as i see the built-in implementation is an iterative one : python docs
Does python have an implementation of more sufficient techniques for finding a substring: Boyer–Moore Algorithm, Rabin–Karp algorithm, etc... ???
EDIT
The question has been extended: Python: Improving sub-string search by embedding sophisticated algorithms.
The actual cpython string search implementation is here:
http://hg.python.org/cpython/file/tip/Objects/stringlib/fastsearch.h
It appears to use Boyer-Moore.
The core implementation does not provide this level of functionality.
You will find implementations for Boyer-Moore or Rabin-Karp for Python using Google.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With