[Python-3000] revamping the io stack, part 2

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Thu May 4 12:23:02 CEST 2006


"tomer filiba" <tomerfiliba at gmail.com> writes:

> read(x) guarantees to return x bytes, or EOFError otherwise
> (and also restoing the stream position).

This is a poor choice of the fundamental operation. For example when
recoding bytes to characters, an analogous interface for a character
stream is inconvenient to implement in terms of this interface for
a byte stream. Ditto for transparent compression and decompression.

Most APIs are based on the Unix semantics of read (reading at most
the given count) and it should be the core. Reading exactly N bytes
can be implemented on top of that.

-- 
   __("<         Marcin Kowalczyk
   \__/       qrczak at knm.org.pl
    ^^     http://qrnik.knm.org.pl/~qrczak/


More information about the Python-3000 mailing list