> In Python 2 "print 'something', statement calls were unbuffered and
> immediately appeared on screen.

No, they weren't.

 --- cut py2print.py ---
from time import sleep

while 1:
  sleep(1)
  print ".",
">

(original) (raw)

On Mon, Jan 9, 2012 at 1:53 PM, Devin Jeanpierre <jeanpierreda@gmail.com> wrote:
> In Python 2 "print 'something', statement calls were unbuffered and
\> immediately appeared on screen.

No, they weren't.

--- cut py2print.py ---
from time import sleep

while 1:
sleep(1)
print ".",
--- cut ---

This produces one dot every second with Python 2.7.2 on Windows.

Python doesn't do any extra buffering or flushing. Usually your

terminal emulator line-buffers stdout. If you don't print a newline

(in Python 2 OR 3) then it doesn't show up until you either flush

(sys.stdout.flush()) or send a newline.


I assume you use Linux. Do you agree that for cross-platform language some behavior should be made consistent?