[issue13761] Add flush keyword to print()

Guido van Rossum report at bugs.python.org
Wed Jan 11 19:27:35 CET 2012

Guido van Rossum <guido at python.org> added the comment:

In the python-ideas discussion people have argued that flush=False should or could be interpreted as "definitely do not flush" which is unimplementable (the buffer may be full, or the stream may be unbuffered, and there is no way to tell a write() call to skip the flushing if the stream's policy would be to flush). Sticklers have proposed to name the flag "force_flush" to avoid this ambiguity, or to pass None instead of False.

I think that's all being hypercorrect -- first of all, nobody is going to explicitly write flush=False since that is the default, and second of all, who could possibly care about not flushing on a per-call basis? The flag should have a short name and simple semantics. flush=True/False does this: if flush is true, an explicit flush() call is made, if it is false, flush() is not called. What the stream does is its business.

nosy: +gvanrossum

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list