[$] Reworking StringIO concatenation in Python

Python string objects are immutable, so changing the value of a string
requires that a new string object be created with the new value. That is
fairly well-understood within the community, but there are some
“anti-patterns” that arise; it is pretty common for new users to build up a
longer string by repeatedly concatenating to the end of the “same” string.
The performance penalty for doing that could be avoided by switching to a
type that is geared toward incremental updates, but Python 3 has
already optimized the penalty away for regular strings. A recent thread on the python-ideas
mailing list explored this topic some.

Source: LWN.net – [$] Reworking StringIO concatenation in Python