[EMAIL PROTECTED] (Alex Martelli) writes: > What's the added value of spelling x.write(v) as x += v? Is it worth > the utter strangeness of having a class which allows += and not + (the > only one in the std library, I think it would be)...?
Sure, + can also be supported. Adding two StringIO's, or a StringIO to a string, results in a StringIO with the obvious contents. > In StringIO's case, it's nice to be able to use the above idiom to > concatenate Unicode strings just as easily as plain ones, for > example -- cStringIO (like file objects) wants plain bytestrings. I wasn't aware of that limitation--maybe cStringIO could be extended to take Unicode. You'd use an encode or decode method to get a bytestring out. Or there could be a mutable-string class separate from cStringIO, to be used for this purpose (of getting rid of the list.append kludge). > But I hope the pure-python "reference" modules stay around (and, > indeed, I'd love for them to _proliferate_, maybe by adopting some > of the work of the pypy guys at some point;). Maybe the standard versions of some of these things can be written in RPython under PyPy, so they'll compile to fast machine code, and then the C versions won't be needed. But with CPython I think we need the C versions. -- http://mail.python.org/mailman/listinfo/python-list