output buffering--am I missing something obvious?

Erik Max Francis max at alcyone.com
Fri Apr 4 17:48:54 EST 2003


Andrew Koenig wrote:

> ark Can someone please explain the following behavior?  Under Python
> 2.2.2
> ark and Solaris 2.8:
> 
> >>> import sys
> >>> sys.stdout.write("foo")
> >>> sys.stdout.flush()
> >>> sys.stdout.write("bar\n")
> >>> bar
> 
> Never mind -- I figured it out.  Apparently the interactive loop
> discards all pending output before reading the next input statement.

Weird, here's what I get on my Python 2.2.2 on Solaris 8 (which I built
from source):

>>> import sys
>>> sys.stdout.write('foo')
foo>>> sys.stdout.flush()
>>> sys.stdout.write('bar\n')
bar

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ If the sky should fall, hold up your hands.
\__/ (a Spanish proverb)
    The laws list / http://www.alcyone.com/max/physics/laws/
 Laws, rules, principles, effects, paradoxes, etc. in physics.




More information about the Python-list mailing list