[Python-checkins] python/dist/src/Misc python.man,1.24,1.25

Guido van Rossum guido@python.org
Mon, 29 Jul 2002 16:02:20 -0400


> > Patch #552812: Better description in "python -h" for -u.
> >
> [...]
> > ! Force stdin, stdout and stderr to be totally unbuffered.  Note that
> > ! there is internal buffering in xreadlines(), readlines() and 
> > file-object
> > ! iterators ("for line in sys.stdin") which is not influenced by this
> > ! option.  To work around this, you will want to use 
> > "sys.stdin.readline()"
> > ! inside a "while 1:" loop.
> 
> For readlines() I think this is the right thing to do, but 
> xreadlines() and file iterators could actually "do the right 
> thing" and revert to a slower scheme if the underlying stream is 
> unbuffered? Or is this overkill?

What's the use case for -u again?  I thought it was pretty rare that
this was needed, and when it's needed, the program probably knows that
it's needed, and can simply avoid using xreadlines.

--Guido van Rossum (home page: http://www.python.org/~guido/)