Antoine Pitrou <pit...@free.fr> added the comment:

In the current state of affaires this is more of a documentation issue.

Python 3 doesn't support totally unbuffered text I/O (and standard streams are 
open in text mode). What `-u` and PYTHONUNBUFFERED do is that the binary layer 
of standard streams is unbuffered, but the text layer is still line-buffered 
(if in a tty).

"python --help" gives you an accurate description:

-u     : unbuffered binary stdout and stderr; also PYTHONUNBUFFERED=x
         see man page for details on internal buffering relating to '-u'

Also, you can try out:

python3 -u -c  'import time, sys; sys.stdout.buffer.write(b"b"); time.sleep(1); 
sys.stdout.buffer.write(b"\n")'

To explicitly flush the text layer, you can use the flush() method.

----------
priority:  -> normal

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue8213>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to