[Python-3000] Comment on iostack library

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Wed Aug 30 11:20:56 CEST 2006

Talin <talin at acm.org> writes:

> It seems to me that no matter how you slice it, you can't have an
> abstract "buffering" layer that is independent of both the layer
> beneath and the layer above.

I think buffering makes sense as the topmost layer, and typically only

Encoding conversion and newline conversion should be performed a block
at a time, below buffering, so not only I/O syscalls, but also
invocations of the recoding machinery are amortized by buffering.

Buffering comes in separate byte and character flavors.

Placing buffering below that makes sense only in cases we want to
decode as little bytes as possible at a time (accepting the slowdown
of encoding one character at a time, but avoiding a syscall per
character). I'm not sure whether this is ever necessary. Finding
the end of HTTP headers can be done before conversion to text.

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

More information about the Python-3000 mailing list