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

Cameron Simpson cs at zip.com.au
Thu Jan 12 00:02:51 CET 2012

[ Taken back on list - I can't see anyway personal here, and the
  objection is a good one. - Cameron

On 11Jan2012 08:41, Paul Moore <p.f.moore at gmail.com> wrote:
| On 11 January 2012 06:15, Cameron Simpson <cs at zip.com.au> wrote:
| > | flush=None?
| >
| > +1 from me, if None means "honour the file's default flushing
| > behaviour".
| The trouble with this is that we then have:
|  - no parameter (default None) => default behaviour
|  - flush=True => Always flush
| and that begs the question of what an explicit flush=False means, and
| people will assume it means "never flush" even thought you can't force
| that as the underlying stream might auto-flush (e.g., at a newline).
| +1 for flush=True/False, with a default of False (meaning do the
| stream's default behaviour).

Hmm. Good point about False suggesting "never flush", but I think it should
just be considered invalid. What about flush=3, or flush=tuple?

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 leaves scope later
for defining a sane (or at least clear) meaning for False if a _useful_
one is ever agreed upon. Call it "reserved".

Cameron Simpson <cs at zip.com.au> DoD#743

Copyright and Patents: To prevent the Progress of Science and useful Arts, by
securing for unlimited Times to Authors and Inventors and Trolls the
exclusive Right to all Writings and Discoveries.
- http://science.slashdot.org/story/11/04/26/211258/Copyright-Law-Is-Killing-Science

More information about the Python-ideas mailing list