[issue4996] io.TextIOWrapper calls buffer.read1()

STINNER Victor report at bugs.python.org
Mon Jan 19 19:17:59 CET 2009


STINNER Victor <victor.stinner at haypocalc.com> added the comment:

I don't understand the motivation of having two different methods 
for "raw" streams: read1() and read(). I would prefer to have only a 
method read() (because "read" is the most common name, whereas read1() 
is only used on Python3), but read() will have to follow the read1() 
rule: at most one syscall. If someone requires a read() method with 
the "one syscall" rule, he can use a raw stream. If you don't care, 
use high level classes (TextIOWrapper, BufferedReader, etc.).

_fileio._FileIO.read() and _socket.socket.recv_into() already respect 
the syscall rule.

Since BytesIO and StringIO don't use kernel object, the syscall rule 
is meaningles.

Note: socket.SocketIO() implements RawIOBase but it has no read() nor 
write() methods ;-) That's maybe why IOBase has no read()/write() 
method.

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue4996>
_______________________________________


More information about the Python-bugs-list mailing list