optimization question

Matt Gerrans mgerrans at mindspring.com
Sun Aug 11 16:13:32 EDT 2002


> Wouldn't the following avoid it altogether?
>
>     return (len(t) == j-i) and (s.find(t,i) != -1)

Actually (s.find(t,i,i)==i) is best, since you don't want to search to the
end of the string (which, as originally stated may be megabytes).

- Matt





More information about the Python-list mailing list