optimization question

Terry Reedy tjreedy at udel.edu
Sun Aug 11 18:28:54 EDT 2002


"Bernard Delmée" <bdelmee at advalvas._ZAPME_.be> wrote in message
news:3d56d836$0$30449$afc38c87 at sisyphus.news.be.easynet.net...
> >
> > Oops, that should be s.find(t,i,j)
> >
>
> Right, but we'd still potentially scan megabytes.
>
> How about: (s.find(t,i,min(j,i+len(t)) == i)

above is taken from context of having first checked that len(t)==j-i
otherwise, you would be right






More information about the Python-list mailing list