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 discuss implementation details, so http://docs.python.org/library/stdtypes.html is of no help. Could someone please point me to the relevant source code?
From stackoverflow
-
I suppose so:
-
You should be able to find it in Objects/stringlib/find.h, although the real code is in fastsearch.h.
-
Looks like the algorithm used originates from Boyer-Moore-Horspool algorithm
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.