Re: Shell re-direction

From: Jeff Epler (jepler_at_unpythonic.net)
Date: 03/21/05


Date: Sun, 20 Mar 2005 17:04:28 -0600
To: Mike Gould <mike@meph.net>


buffering.

In the first case, there is either no buffering, or line buffering on
sys.stdout, so you see the lines in order.

In the second case, there is a buffer of a few hundred or thousand bytes
for stdout in the python process, and you see the two lines of python
output together (in this case, when the python process exits and flushes
all its buffers).

You can use the "flush" method on file objects to "clear out" these
buffers.

Jeff