Speeding up: s += "string"
sik0fewl
xxdigitalhellxx at hotmail.com
Tue Apr 15 10:29:35 EDT 2003
Cameron Laird wrote:
> I'm not optimistic. I'll be more precise: the problem
> is real, and good solutions are sensitive to data char-
> acteristics. It's easy to improve performance of the
> s1 += s2 operations that characterize e-mail filtering
> while simultaneously degrading unacceptably the same
> operation embedded in an XML filter. I am close to
> asserting the conjecture that every solution harms too
> many existing legitimate users.
Just adding my two cents..
People should keep in mind that s += a is shorthand for s = s + a. If you
look at it the second way you can clearly see that a is appending to s and
then s is *assigned* that value. In both cases two operations are being done.
Perhaps we could introduce .= as a true assign/append operation. Although
this would still be a mutable operation, which contradicts the documents.
--
Ryan
More information about the Python-list
mailing list