7stud wrote: > I assume all input is buffered by default, so I'm not sure how it > explains things to say that input from sys.stdin is buffered.
The difference with sys.stdin is that it has indeterminate length until you signal EOF. I believe you'd get the same problem reading from, say, a named pipe. >> I typed many lines, but lst contains only one item, as expected. Same as >> your regular file example: the file contains many lines, but only the >> first goes into the list. > > Interesting example--not as I expected! But there is a difference in > the two examples isn't there? When you iterate over a file, the whole > file isn't put into an internal buffer first, is it? It is if the file is smaller than the buffer size. >> This should be f = iter(raw_input,"") and this will end in a EOFError >> and stop on blank line. So you need a wrapper > > Why a wrapper? Because without a wrapper you'll get EOFError, while the file iterator would ordinarily give you StopIteration. -- Michael Hoffman -- http://mail.python.org/mailman/listinfo/python-list