On Nov 22, 3:41 am, Wayne Brehaut <[EMAIL PROTECTED]> wrote: > If you have PythonWin 2.5.1 (r251:54863, May 1 2007, 17:47:05) [MSC v.1310 > 32 bit (Intel)] on win32.for example, using Help, Index, eof gives: > > eof > Token used to determine end of file. This will be set to the empty > string (''), in non-POSIX mode, and to None in POSIX mode. New in > version 2.3. > > If you don't use Active State Python--and even of you do--it helps to > have these three "official" references handy: > If the end of the file has been reached, f.read() will return an empty > string (""). > > 3.9 File Objects > > There, and checking for "EOF" you'll note that both read( [size]) and > readline( [size]) include: > > "An empty string is returned only when EOF is encountered > immediately." > > HTH?
Nope! I don't want to buffer input myself, and don't want to store look-ahead and push it back. f.read()/readline() is not a non- destructive check, and thus won't do. > >In Ruby it's f.eof: > > It also is not nice to talk Ruby here--nor Perl. Refer to C/C++ if > necessary. Well folks compare scripting languages all the time, and surely Ruby is closer to Python than C++. Since Ruby can do f.eof, which is easily found in its references, and Python can't, or its EOF can't easily be found -- the one *equivalent* to a semantically clear Ruby's, or Pascal's IIRC, f.eof -- something's missing here... Why do I have to count sizes of lines read and compare it to some filesize or do other weird tricks just to see, in a way not changing my input stream, whether it's at the, well, EOF? Cheers, Alexy -- http://mail.python.org/mailman/listinfo/python-list