[Python-Dev] Backwards incompatible sys.stdout.write() behavior in Python 3 (Was: [Python-ideas] Pythonic buffering in Py3 print()) (original) (raw)

Terry Reedy tjreedy at udel.edu
Wed Jan 18 00:58:55 CET 2012


On 1/17/2012 5:59 AM, anatoly techtonik wrote:

1. print() buffers output on Python3 2. print() also buffers output on Python2, but only on Linux

No, print() does not buffer output. It merely sends it to a file.

4. print() is not guilty - it is sys.stdout.write() that buffers output

Oh, you already know that 1&2 are false.

So is 4, if interpreted as saying that sys.stdout.write() will buffer output. sys.stdout can be any file-like object. Its .write method may buffer output, or it may not. With IDLE, it does not. We have been over this before. At your instigation, the doc has been changed to make this clearer. At your request, a new feature has been added to force flushing. By most people's standards, you won.

-- Terry Jan Reedy



More information about the Python-Dev mailing list