Florent Xicluna <la...@yahoo.fr> added the comment:

I checked the code, and it is the right thing:

Example 1 (fastsearch):

s, p = "ABCDEABCF", "BCD"
s.rfind(p)

# i = 6  is first candidate, but "BCF" != "BCD"
# then s[i-1] = "A" is not part of pattern
# so we skip 3 chars: next loop is i = 2
# etc...


Example 2 (msg97039):

s, p = "ABCDBCBCF", "BCB"
s.rfind(p)

# i = 6  is first candidate, but "BCF" != "BCB"
# then s[i-m] = "D" is not part of pattern
# so we skip 3 chars: next loop is i = 2.. and it fails!

I've tested many examples to understand and verify the algorithm.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue7462>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to