On 02/12/2013 05:25 PM, Christian Tismer wrote:
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?

I've always hated the "".join(array) idiom for "fast" string concatenation--it's ugly and it flies in the face of TOOWTDI.  I think everyone should use "x = a + b + c + d" for string concatenation, and we should just make that fast.

In 2006 I proposed "lazy string concatenation", a sort of rope that hid the details inside the string object.  If a and b are strings, a+b returned a string object that internally lazily contained references to a and b, and only computed its value if you asked for it.  Here's the Unicode version:
Why didn't it get accepted?  I lumped in lazy slicing, a bad move as it was more controversial.  That and the possibility that macros like PyUnicode_AS_UNICODE could now possibly fail, which would have meant checking 400+ call sites to ensure they handle the possibility of failure.  This latter work has already happened with the new efficient Unicode representation patch.

I keep thinking it's time to revive the lazy string concatenation patch.