New (?) suggestion re: 'while x = f(): ...'

Greg Ewing look at replyto.address.invalid
Thu May 30 00:34:09 EDT 2002


Ville Vainio wrote:
> 
> Speaking of which - why does the iterator of file objects return
> strings with trailing \n's in place? Considering that we don't have to
> detect EOF by ''...

Otherwise you wouldn't be able to tell whether
the last line of the file ended with '\n'.

Also, it would be confusingly inconsistent with
other ways of reading lines from files.

-- 
Greg Ewing, Computer Science Dept, 
University of Canterbury,	  
Christchurch, New Zealand
http://www.cosc.canterbury.ac.nz/~greg



More information about the Python-list mailing list