Paul Rubin <http://[EMAIL PROTECTED]> writes: > > After all, how do you think StringIO is implemented internally? A list > > of strings and a ''.join at the end are the best way that comes to mind, > > I'd have used the array module.
I just checked the implementation and it uses ''.join combined with some bogo-optimizations to cache the result of the join when you do a seek or write. That is, .seek can take linear time instead of constant time, a pretty bogus situation if you ask me, though maybe the amortized time isn't so bad over multiple calls. I didn't check how cStringIO does it. -- http://mail.python.org/mailman/listinfo/python-list