Can the following io module concepts be clarified: blocking vs non-blocking raw-streams and interactive/non-interactive raw-streams?

Viewed 21

I've been reading through the io module documentation and some of the concepts mentioned in passing are not clear to me. The following passages are taken from the doc-page:

BufferedIOBase.read(size=-1): If the argument is positive, and the underlying raw stream is not interactive, multiple raw reads may be issued to satisfy the byte count (unless EOF is reached first). But for interactive raw streams, at most one raw read will be issued, and a short result does not imply that EOF is imminent.

BufferedIOBase.read: A BlockingIOError is raised if the underlying raw stream is in non blocking-mode, and has no data available at the moment.

BufferedWriter.write(b): When in non-blocking mode, a BlockingIOError is raised if the buffer needs to be written out but the raw stream blocks.

  1. Under what conditions is the raw stream interactive? Examples would be helpful.
  2. When is the raw-stream underlying a BufferedIOBase instance in non-blocking mode, and when does it block? Examples would again be helpful.
0 Answers
Related