optimization question

Peter Hansen peter at engcorp.com
Sun Aug 11 23:14:19 CEST 2002


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



More information about the Python-list mailing list