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

Antoine Pitrou solipsis at pitrou.net
Thu Aug 25 18:35:42 CEST 2011


On Thu, 25 Aug 2011 11:41:11 -0400
Terry Reedy <tjreedy at udel.edu> wrote:
> On 8/25/2011 6:38 AM, k_bx wrote:
> 
> > Oh, and also, I really like how Python had it's MutableString class
> > since forever, but deprecated in python 3.
> 
> (removed, i presume you mean...) and added bytearray. I have no idea if 
> += on such is any better than O(n*n)

On bytearray? Yes, it is. It's a similar algorithm as lists, and
therefore O(total length) amortized.

Regards

Antoine.





More information about the Python-ideas mailing list