On 11/3/2015 10:42 AM, Chris Angelico wrote:
On Wed, Nov 4, 2015 at 2:00 AM, Random832 <random...@fastmail.com> wrote:
Nobody <nobody@nowhere.invalid> writes:
It's probably related to the fact that std{in,out,err} are Unicode
streams.
There's no fundamental reason a Unicode stream should have to be line
buffered. If it's "related", it's only in that an oversight was made in
the course of making that change.
The current behavior is not an 'oversight'. I was considered, decided,
and revisited in https://bugs.python.org/issue13601. Guido:
"Line-buffering should be good enough since in practice errors messages
are always terminated by a newline." If not, print(part_line,
file=sys.stderr, flush=True) works for the unusual case.
Yep. Unicode *input* streams need to be buffered, but *output* can
always be insta-flushed. The only significance of Unicode to output is
that a single character may cause multiple bytes to be output; and
since output can block for even a single byte, it should be no
different.
+1 for making sys.stderr unbuffered.
-
Terry Jan Reedy
--
https://mail.python.org/mailman/listinfo/python-list