Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > sys.stdout vs. sys.stderr

Reply
Thread Tools

sys.stdout vs. sys.stderr

 
 
Mitchell L Model
Guest
Posts: n/a
 
      01-11-2010
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?
 
Reply With Quote
 
 
 
 
Martin v. Loewis
Guest
Posts: n/a
 
      01-11-2010
> 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
 
Reply With Quote
 
 
 
 
Nobody
Guest
Posts: n/a
 
      01-11-2010
On Mon, 11 Jan 2010 10:09:36 +0100, Martin v. Loewis wrote:

>> 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.


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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off




Advertisments