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

Terry Reedy tjreedy at udel.edu
Thu Jan 12 04:03:49 CET 2012

On 1/11/2012 8:40 PM, Cameron Simpson wrote:
> On 11Jan2012 19:15, Terry Reedy<tjreedy at udel.edu>  wrote:
> | On 1/11/2012 6:02 PM, Cameron Simpson wrote:
> |>Better if we only specify behaviour for True (flush now) and
> |>None/default/missing (flush default) and make it slightly clear that
> |>other values do not have defined behaviour.
> |
> | That was the intent of my suggested doc rewording -- file controls
> | flushing unless flush=True is given. What I wrote on the issue was a
> | first try and I suspect that there are other and perhaps better
> | concise wordings. Post one on the issue if you have one. (But
> | writing in 'doc style' is not always easy ;-).
> Do I comment here, or in #11633 (which is closed)

After much discussion that included the possibility of a behavior 
change, that issue became about changing the print doc, especially for 3.2.

> or in #13761?

After Guido's approval of leaving the default behavior as is but adding 
a parameter to change it, that was opened for the behavior change for 
3.3. That change will require further doc change for 3.3.

> BTW, regarding #11633, I don't like your sentence:
>    Use ``sys.stdout.flush()`` to ensure immediate appearance on a screen
> Shouldn't that be "*file*.flush()" ?

That was my original idea but I changed it after internal debate. But I 
was at most 60-40 for what I did.

> I would _not_ want to give a
> shallow reader the idea that flushing stdout magicly sorts their
> problems with a specific file. And I've seen that level of logical gap
> in various questions on python-list (and elsewhere, of course).
> I'd also change "ensure immediate appearance on a screen" to "ensure
> immediate output, for example to ensure appearance on a screen".
> Again, it changes the wording from "to perform this specific special
> case call flush" to "calling flush does blah, for example to aid this
> specific case".

If one of the doc people agree with you enough to refine the effectively 
temporary change for 3.2, fine, but I do not think it worth the effort. 
I suggest you focus on the doc further change for 3.3 after the behavior 
change. That will potentially be in the docs for several future 
versions. For that, post a post-change suggestion to #13761.

Terry Jan Reedy

More information about the Python-ideas mailing list