> def eqsub(s, i, j, t): > return (len(t) == j-i) and s[i:j] == t > > which avoids building the substrings unless necessary. > Wouldn't the following avoid it altogether? return (len(t) == j-i) and (s.find(t,i) != -1)