This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients amaury.forgeotdarc, docs@python, techtonik, terry.reedy, vstinner
Date 2011-03-22.22:44:12
SpamBayes Score 1.6929735e-11
Marked as misclassified No
Message-id <1300833853.79.0.644803146039.issue11633@psf.upfronthosting.co.za>
In-reply-to
Content
Python 3.2, WinXP, IDLE edit window, F5 Run:
'Processing ...' appears immediately, 'Done' 3 sec later.
The only difference between printtest2/3 is where 'Done' appears.

Behavior is same when pasting into interactive interpreter -- has to be since the first two prints are executed before the sleep. I presume interpreter flushes before or after printing next prompt. IDLE must do same even when running from editor even when not printing prompts.

Anatoly, I gather you ran files by some other method.

I disagree with closing this yet. Print was designed to be a simplified wrapper around sys.stdout.write (and now, any file.write). Requiring that one import sys to use print goes against that.

I have always experienced and expected Python's print to screen to be immediately visible. I thought that was pretty standard in other languages with a print-to-screen separate from general file-write. When printing to screen, efficiency is, I believe, a non-issue. Writing to files or the net is a whole different ballgame.

Amaury's idea of checking isatty seems good. Otherwise, print should gain an optional, no-default flush=True/False parameter (no default because behavior currently varies.) Until then, non-flushing *should* be documented. The current doc for print does not seem to address the issue either way.

Amaury, I though 'run from console' more or less meant 'isatty', so I am not sure I understand your comment.
History
Date User Action Args
2011-03-22 22:44:13terry.reedysetrecipients: + terry.reedy, amaury.forgeotdarc, vstinner, techtonik, docs@python
2011-03-22 22:44:13terry.reedysetmessageid: <1300833853.79.0.644803146039.issue11633@psf.upfronthosting.co.za>
2011-03-22 22:44:12terry.reedylinkissue11633 messages
2011-03-22 22:44:12terry.reedycreate