Frankenstring

Peter Otten __peter__ at web.de
Wed Jul 13 13:29:05 EDT 2005


Thomas Lotze wrote:

> Peter Otten wrote:
> 
>>>>> class frankenstring(StringIO):
>> ...     def next(self):
>> ...             c = self.read(1)
>> ...             if not c:
>> ...                     raise StopIteration
>> ...             return c
> 
> Repeated read(1) on a file-like object is one of the ways of doing it with
> existing tools I labelled "clumsy" in the original posting ;o)

Not clumsy, just slow. I hope you'll let us know how much faster your final
approach turns out to be. By the way, I'll consider anything that doesn't
implement seek() and tell() cheating :-)

Peter




More information about the Python-list mailing list