On 2010-08-11, Peter Otten <__pete...@web.de> wrote: > Grant Edwards wrote:
>>> If you want to handle stdin a single line at a time from inside of >>> your program, you can access it using sys.stdin.readline(). >> >> That doesn't have any effect on stdin buffering. > > "for line in stream"-style file iteration uses an internal buffer that is > not affected by the -u option; stream.readline() doesnt use this > optimization. You're right. Why didn't I know that? Using "for line in sys.stdin" does it's own buffering. In my tests using sys.stdin.readline() worked as the OP desired either with or without -u, either with or without cat. IOW, "cat" isn't buffering output on my system (or if it is, it's line-buffering). -- Grant Edwards grant.b.edwards Yow! I don't know WHY I at said that ... I think it gmail.com came from the FILLINGS in my rear molars ... -- http://mail.python.org/mailman/listinfo/python-list