[Python-ideas] Create a StringBuilder class and use it everywhere

Arnaud Delobelle arnodel at gmail.com
Thu Aug 25 16:02:41 CEST 2011


On 25 August 2011 13:31, Mike Graham <mikegraham at gmail.com> wrote:
> On Thu, Aug 25, 2011 at 5:28 AM, k_bx <k.bx at ya.ru> wrote:
>>    def main_bucket():
>>        b = StringBuilder(u"initial value ")
>>        for i in xrange(30000000):
>>            b += u"more data"
>>        return unicode(b)
>
> This doesn't seem nicer to read and write to me than the list form. I
> also do not see any reason to believe it will stop people from doing
> it the quadratic way if the ubiquitous make-a-list-then-join idiom
> does not.

+1

-- 
Arnaud



More information about the Python-ideas mailing list