Matt Gerrans wrote: (after various attempts at "the best way"): > > ...(s.find(t,i,i)==i) ... > > Oops, that should be s.find(t,i,j) Heh. :-) All of which are exactly the reasons to make it *work*, then make it fast. Starting with s[i:j] == t without any optimization is a fine way to begin... then refactor when the tests show it's all working perfectly. -Peter