Terry J. Reedy <tjre...@udel.edu> added the comment:

The current doc says

"print([object, ...], *, sep=' ', end='\n', file=sys.stdout) 
Print object(s) to the stream file, separated by sep and followed by end. sep, 
end and file, if present, must be given as keyword arguments.

All non-keyword arguments are converted to strings like str() does and written 
to the stream, separated by sep and followed by end. Both sep and end must be 
strings; they can also be None, which means to use the default values. If no 
object is given, print() will just write end.

The file argument must be an object with a write(string) method; if it is not 
present or None, sys.stdout will be used."

(The bit about None, said twice, could be factored out and said once after the 
second sentence.)

This is exactly what print does and Guido today (Python ideas) said that is 
what it should do and that "Apps that need flushing should call flush()." So a 
code change is rejected.

The issue title was incorrect. The print function does not do any buffering. 
The file object it writes to may. Even sys.stdout may or may not. 

We could add at the end a sentence or two something like

"Output buffering is determined by *file*. Call file.flush() to ensure, for 
instance, immediate appearance on a screen."

----------
assignee:  -> docs@python
components: +Documentation -Interpreter Core
nosy: +docs@python
stage:  -> needs patch
title: Document that print buffers output when end='' -> Document that print 
may need explicit flushing

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

Reply via email to