(original) (raw)
2011/11/25 Paul Moore <p.f.moore@gmail.com>
The optimisation mentioned was an attempt (by mutating an existing
string when the runtime determined that it was safe to do so) to hide
the consequences of this fact from end-users who didn't fully
understand the issues. It was relatively effective, but like any such
case (floating point is another common example) it did some level of
harm at the same time as it helped (by obscuring the issue further).
It would be nice to have the optimisation back if it's easy enough to
do so, for quick-and-dirty code, but it is not a good idea to rely on
it (and it's especially unwise to base benchmarks on it working :-))
Note that this string optimization hack is still present in Python 3,
but it now acts on \*unicode\* strings, not bytes.
--
Amaury Forgeot d'Arc
Amaury Forgeot d'Arc