This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author martin.panter
Recipients docs@python, martin.panter, porton
Date 2019-01-31.23:28:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1548977325.06.0.248213750705.issue35870@roundup.psfhosted.org>
In-reply-to
Content
I agree that the documentation should be clearer about the first two points. Considering that the "input" function and by default the "str.splitlines" method both behave differently, I often had to re-learn this when I had less Python experience.

The expected behaviour as I understand is the line terminator is included if it was read. It is not included if the size limit or EOF was reached first. The Python 2 documentation <https://docs.python.org/2/library/stdtypes.html#file.readline> is clear about both the newline being included and EOF behaviour.

Regarding text files, if you mean the "TextIOWrapper.readline" method, I think it is reasonable to assume you get the translated line endings as specified by the constructor's "newline" argument: <https://docs.python.org/3/library/io.html#io.TextIOWrapper>. Newline='' and newline='\r\n' would keep the '\r\n' terminators, and newline=None would translate them to '\n'.
History
Date User Action Args
2019-01-31 23:28:46martin.pantersetrecipients: + martin.panter, docs@python, porton
2019-01-31 23:28:45martin.pantersetmessageid: <1548977325.06.0.248213750705.issue35870@roundup.psfhosted.org>
2019-01-31 23:28:45martin.panterlinkissue35870 messages
2019-01-31 23:28:44martin.pantercreate