class InputStream(Stream):
def read(self): # Reads 1 byte
return os.stdin.read(1)
def readline(self):
ret = self.readrec('\n') # or whatever constant represents the EOL
return ret
class Stream(object):
def read(self):
raise Exception, 'cannot read'
def readrec(self,terminator):
ret = ''
while ret != terminator: ret = ret + self.read()
return ret
def write(self):
raise Exception, 'cannot write'
def writeRec(self, terminator):
''' writeRec returns self as a list split by terminator '''
ret = str(self)
return str(ret).split(terminator)
--
Cheers,
Hasan Diwan < [EMAIL PROTECTED]>
_______________________________________________ Python-3000 mailing list Python-3000@python.org http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com