(original) (raw)
On 13.02.13 02:09, Alexandre Vassalotti
wrote:
On Tue, Feb 12, 2013 at 1:44 PM, Antoine Pitrou <solipsis@pitrou.net> wrote:
It's idiomatic because strings are immutable (by design, not because of
an optimization detail) and therefore concatenation \*has\* to imply
building a new string from scratch.
Not necessarily. It is totally possible to implement strings such they are immutable and concatenation takes O(1): ropes are the canonical example of this.
Ropes have been implemented by Carl-Friedrich Bolz in 2007 as I remember.
No idea what the impact was, if any at all.
Would ropes be an answer (and a simple way to cope with string mutation
patterns) as an alternative implementation, and therefore still justify
the usage of that pattern?
-- Christian Tismer :^) Software Consulting : Have a break! Take a ride on Python's Karl-Liebknecht-Str. 121 : \*Starship\* http://starship.python.net/ 14482 Potsdam : PGP key -> http://pgp.uni-mainz.de phone +49 173 24 18 776 fax +49 (30) 700143-0023 PGP 0x57F3BF04 9064 F4E1 D754 C2FF 1619 305B C09C 5A3B 57F3 BF04 whom do you want to sponsor today? http://www.stackless.com/