Hi, I want to implement a tokenizer for some syntax. So I thought I'd subclass StringIO and make my new class return tokens on next().
However, if I want to read tokens from two places in the string in turns, I'd either need to do some housekeeping of file pointers outside the tokenizer class (which is ugly) or use two tokenizers on the same data buffer (which seems impossible to me using my preferred approach as a file-like object has exactly one file pointer). Is there a way for multiple StringIO objects to share a buffer of data, or do I have to give up on subclassing StringIO for this purpose? (An alternative would be a tokenizer class that has a StringIO instead of being one and do the file pointer housekeeping in there.) -- Thomas -- http://mail.python.org/mailman/listinfo/python-list