[Python-ideas] Pythonic buffering in Py3 print()

Stefan Behnel stefan_ml at behnel.de
Wed Jan 11 17:03:34 CET 2012

Victor Stinner, 11.01.2012 09:46:
> There is already an option for flush: -u command line option. Can't we
> change print() to flush if end is set and -u option is used, instead
> of introducing a new option?
> I understand that a command line option is less practical than a new
> keyword, especially on Windows.

For one, it doesn't allow the program code to explicitly enforce the flush
at a specific point if it depends on a command line switch.

Note that the caller of print() may not even know what "print" really is at
a given point in the execution, and what (if any) output stream it will
write to. Doesn't have to be sys.stdout. So a new keyword argument makes
sense to me (and I agree that calling it "flush" should be enough).


More information about the Python-ideas mailing list