[Python-Dev] Decoding incomplete unicode

Josiah Carlson jcarlson at uci.edu
Wed Jul 28 03:26:04 CEST 2004

> - readline() and readlines() have an additional option
>    for dropping the u"\n".

I'll point out (since no one else has so far) that the reasons for
keeping the linefeed at the end of lines returned by readline() and
readlines() are documented here:

Specifically it allows one to use the following and have it "do the
right thing".

while 1:
    line = obj.readline()
    if not line:

Having the option of readline() and readlines() being ambiguous anywhere
sounds like a misfeature.  Furthermore, since all other readline and
readlines calls that do not inherit from StreamReader use the
unambiguous "always include the line ending", changing StreamReader to
be different is obviously the wrong thing to do.

 - Josiah

More information about the Python-Dev mailing list