Frankenstring
ucntcme at gmail.com
ucntcme at gmail.com
Thu Jul 14 18:08:42 EDT 2005
well that appears to have been munged up ...
that tell() belongs immediately after self.str. making it
self.str.tell()
class FrankenString:
def __init__(self,string=None):
self.str = StringIO(string)
self.atEnd = False
self.lastidx = 0
self.seek = self.str.seek
self.tell = self.str.tell
def __iter__(self):
while not self.atEnd:
char = self.str.read(1)
idx = self.str.tell()
if self.lastidx == idx:
self.atEnd = True
self.lastidx = idx
yield char
More information about the Python-list
mailing list