This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author glyph
Recipients arjennienhuis, benjamin.peterson, christian.heimes, eric.smith, exarkun, ezio.melotti, glyph, gvanrossum, loewis, martin.panter, pitrou, serhiy.storchaka, terry.reedy, uau, vstinner
Date 2013-01-22.22:51:03
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <>
In-reply-to <>
On Jan 22, 2013, at 1:46 PM, STINNER Victor <> wrote:

> 2013/1/22 Guido van Rossum <>:
>> Twisted still would like to see this.
> Sorry, but this argument doesn't convince me. A better argument is
> that bytes+bytes+...+bytes is inefficient: it creates a lot of
> temporary objects instead of computing the final size directly, or
> using realloc.

Uh, yes.  That's one of the reasons (given above) that Twisted would still like to see this.  It seemed to me that Guido was stating a fact there, not making an argument.  The Twisted project *would* like to see this, I can assure you, regardless of whether you're convinced or not :).

> str%args and str.format() uses realloc() and overallocates its
> internal buffer to avoid too many calls to realloc().

More importantly, it's fairly easy to add many optimizations of this type to an API in the style of .format(), even if it's not present in the first round; optimizing bytes + bytes + bytes requires slightly scary interactions with refcounting and potentially GC, like the += optimization.  The API just has more information to go on, and that's a good thing.
Date User Action Args
2013-01-22 22:51:03glyphsetrecipients: + glyph, gvanrossum, loewis, terry.reedy, exarkun, pitrou, vstinner, eric.smith, christian.heimes, benjamin.peterson, ezio.melotti, arjennienhuis, uau, martin.panter, serhiy.storchaka
2013-01-22 22:51:03glyphlinkissue3982 messages
2013-01-22 22:51:03glyphcreate