Re: standard input, for s in f, and buffering

2008-04-01 Thread Jorgen Grahn
On Mon, 31 Mar 2008 22:27:39 -0700 (PDT), Paddy [EMAIL PROTECTED] wrote: On Mar 31, 11:47 pm, Jorgen Grahn [EMAIL PROTECTED] wrote: On 31 Mar 2008 06:54:29 GMT, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Sun, 30 Mar 2008 21:02:44 +, Jorgen Grahn wrote: I realize this has to

Re: standard input, for s in f, and buffering

2008-03-31 Thread Marc 'BlackJack' Rintsch
On Sun, 30 Mar 2008 21:02:44 +, Jorgen Grahn wrote: I realize this has to do with the extra read-ahead buffering documented for file.next() and that I can work around it by using file.readline() instead. The problem is, for s in f is the elegant way of reading files line by line. With

Re: standard input, for s in f, and buffering

2008-03-31 Thread Jorgen Grahn
On 31 Mar 2008 06:54:29 GMT, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Sun, 30 Mar 2008 21:02:44 +, Jorgen Grahn wrote: I realize this has to do with the extra read-ahead buffering documented for file.next() and that I can work around it by using file.readline() instead. The

Re: standard input, for s in f, and buffering

2008-03-31 Thread Paddy
On Mar 31, 11:47 pm, Jorgen Grahn [EMAIL PROTECTED] wrote: On 31 Mar 2008 06:54:29 GMT, Marc 'BlackJack' Rintsch [EMAIL PROTECTED] wrote: On Sun, 30 Mar 2008 21:02:44 +, Jorgen Grahn wrote: I realize this has to do with the extra read-ahead buffering documented for file.next() and

standard input, for s in f, and buffering

2008-03-30 Thread Jorgen Grahn
One thing that has annoyed me for quite some time. I apologize if it has been discussed recently. If I run this program on Unix (Python 2.4.4, on Debian Linux) import sys for s in sys.stdin: print '', s , and type the input on the keyboard rather than piping a file into it,