Efficient string concatenation methods

Josiah Carlson jcarlson at uci.edu
Thu May 6 02:49:26 EDT 2004


> Is there any particular reason why the space allocated does not
> increase *exponentially*, say with a factor of 1.5 or 2? That's how
> the string class is implemented in C++, IIRC. That'd give you
> amortized linear rather than quadratic time.

The C++ string class is mutable.  When you have immutable strings, 
having extra space at the end is useless.

  - Josiah



More information about the Python-list mailing list