On Dec 28, 2007 2:47 PM, Brett Cannon <[EMAIL PROTECTED]> wrote: > No specific hints, but why do you feel you must implement the whole > thing in C? Can't you just import 'io' in your StringIO code and make > calls into the Python code? >
Honestly, I didn't really consider this as a possibility, since TextIOWrapper only accepts bytes buffer, as far as I know. The other obstacle is newline conversion has a fair amount of state that needs to be managed at the API level. But, I thinking two better solutions. Could I add a "switch" to TextIOWrapper to disable the encoding/decoding process for a unicode buffer? Then, I could wrap my StringIO with TextIOWrapper without adding any huge overhead. Otherwise, could I simply subclass my StringIO and write the newlines conversion facilities in Python? Btw, my reimplementation of IncrementalNewlineDecoder in C was just an experiment. I certainly don't indent to propose it as a replacement. -- Alexandre _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
