sys.stdout vs. sys.stderr

M

Mitchell L Model

In Python 3.1 is there any difference in the buffering behavior of the
initial sys.stdout and sys.stderr streams? They are both line_buffered
and stdout doesn't seem to use a larger-grain buffering, so they seem
to be identical with respect to buffering. Were they different at some
earlier point in Python's evolution?
 
M

Martin v. Loewis

In Python 3.1 is there any difference in the buffering behavior of the
initial sys.stdout and sys.stderr streams?
No.

Were they different at some earlier point in Python's evolution?

That depends on the operating system. These used to be whatever the
C library set up as stdout and stderr. Typically, they were buffered
in the same way.

Regards,
Martin
 
N

Nobody

That depends on the operating system. These used to be whatever the
C library set up as stdout and stderr. Typically, they were buffered
in the same way.

On Unix, stdout will be line buffered if it is associated with a tty
and fully buffered otherwise, while stderr is always unbuffered.

On Windows, stdout and stderr are unbuffered if they refer to a character
device, fully buffered otherwise (Windows doesn't have line buffering;
setvbuf(_IOLBF) is equivalent to setvbuf(_IOFBF)).

ANSI C says:

As initially opened, the standard error stream is not fully buffered; the
standard input and standard output streams are fully buffered if and only
if the stream can be determined not to refer to an interactive device.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,054
Latest member
TrimKetoBoost

Latest Threads

Top