[Types-sig] File Protocol Proposal
Paul Prescod
paulp@ActiveState.com
Tue, 13 Mar 2001 18:21:14 -0800
Writefile objects will be required only to have a .write() method.
Readfile objects will be required only to have a .read([size]) method.
Users will be strongly encouraged to inherit from base classes that
define other methods (e.g. readlines) in terms of the required method.
e.g.
class UserReadFile:
def close():
self.closed=true
def flush():
pass
def isatty():
return false
def readline():
while not self.closed and char is not newline:
read()
def readlines():
read a buncha lines...
def read():
raise NotImplementedException
--
Python:
Programming the way
Guido
indented it.
- (originated with Skip Montanaro?)