Stringbuffer

chris at onca.catsden.net chris at onca.catsden.net
Sat Feb 3 21:52:09 EST 2001


On 4 Feb 2001, Joshua Marshall wrote:

> I'm plucking characters off a stream and concatenating them.
> Currently, I'm doing something like:
>
>    buf = []
>    while stream.more():
>       buf = buf + stream.read()
>    string.join(buf, '')
>
> Is there a faster way?  I'm thinking of writing a Stringbuffer
> class in C.  Or does a quick, reliable one already exist?

You could try buf.append(stream.read())

And... I dont know what you're trying to achive with string.join(buf,'').
Are you just adding a space?? :)


   ("`-/")_.-'"``-._        Ch'marr, a.k.a.
    . . `; -._    )-;-,_`)  Chris Cogdon <chmarr at furry.org.au>
   (v_,)'  _  )`-.\  ``-'
  _.- _..-_/ / ((.'       FC1.3: FFH3cmA+>++C++D++H++M++P++R++T+++WZ++Sm++
((,.-'   ((,/   fL               RLCT acl+++d++e+f+++h++i++++jp-sm++





More information about the Python-list mailing list