optimization question

Andrew Koenig ark at research.att.com
Sun Aug 11 11:52:33 EDT 2002


If s and t are strings, and I evaluate an expression of the form

    s[i:j] == t

can I count on the implementation not to form s[i:j] as a new
substring?  Suppose, for instance, that s is many megabytes
long, i and j are far apart, and t is very short.  Can I assume
that the execution time for this comparison will be no worse
than O(len(t)), or must I assume O(j-1)?


-- 
Andrew Koenig, ark at research.att.com, http://www.research.att.com/info/ark



More information about the Python-list mailing list