[Python-Dev] Usage of += on strings in loops in stdlib

Antoine Pitrou solipsis at pitrou.net
Wed Feb 13 10:31:42 CET 2013

Le Wed, 13 Feb 2013 09:02:07 +0100,
Victor Stinner <victor.stinner at gmail.com> a écrit :
> I added a _PyUnicodeWriter internal API to optimize str%args and
> str.format(args). It uses a buffer which is overallocated, so it's
> basically like CPython str += str optimization. I still don't know how
> efficient it is on Windows, since realloc() is slow on Windows (at
> least on old Windows versions).
> We should add an official and public API to concatenate strings.

There's io.StringIO already.



More information about the Python-Dev mailing list