A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-July/046466.html below:

[Python-Dev] Decoding incomplete unicode

[Python-Dev] Decoding incomplete unicode [Python-Dev] Decoding incomplete unicodeJosiah 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:
http://docs.python.org/lib/bltin-file-objects.html#foot3271

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

while 1:
    line = obj.readline()
    if not line:
        break
    process(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

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4