On Wed, Feb 13, 2013 at 5:42 PM, Alexandre Vassalotti
<alexan...@peadrop.com> wrote:
> On Tue, Feb 12, 2013 at 5:25 PM, Christian Tismer <tis...@stackless.com>
> wrote:
>>
>> 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 don't think so. Ropes are really useful when you work with gigabytes of
> data, but unfortunately they don't make good general-purpose strings.
> Monolithic arrays are much more efficient and simple for the typical
> use-cases we have in Python.

If I recall correctly, io.StringIO and io.BytesIO have been updated to
use ropes internally in 3.3. Writing to one of those and then calling
getvalue() at the end is the main alternative to the list+join trick
(when concatenating many small strings, the memory saving relative to
a list can be notable since strings have a fairly large per-instance
overhead).

Cheers,
Nick.

-- 
Nick Coghlan   |   ncogh...@gmail.com   |   Brisbane, Australia
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to