cs at zip.com.au
Wed Oct 22 01:46:56 CEST 2014
On 21Oct2014 16:16, Dan Stromberg <drsalists at gmail.com> wrote:
>>> This is tremendously inefficient. It demands a context switch for
>>> every character.
>> Inefficiency isn't an issue when you generate one byte a second.
>Of course, but who's doing one byte per second? You and I in our
>tests, and perhaps some application developers with remarkably
>undemanding I/O. That doesn't really mean we should _recommend_ a
>series of os.read(0, 1)'s.
Indeed not. But there is one glaring exception: the shell's read builtin.
Because it can be interspersed in a script between other input-consuming
commands, it _must_ read no more than one line, and therefore is has to read in
increments of 1 character.
Of course, that says nothing about the upstream write() granularity.
I now return y'all to your regularly sheduled nit picking.
Cameron Simpson <cs at zip.com.au>
If it ain't broken, keep playing with it.
More information about the Python-list