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.

classification
Title: clarify newline documentation for open and io.TextIOWrapper.
Type: Stage: resolved
Components: Documentation Versions: Python 3.2, Python 3.3
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: asvetlov, chris.jerdonek, docs@python, python-dev
Priority: normal Keywords: easy

Created on 2012-08-11 19:14 by chris.jerdonek, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (6)
msg167995 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-08-11 19:14
The documentation of io.TextIOWrapper's newline argument is somewhat confusing and perhaps reversed from what was intended.  (For example, the subprocess module uses the reverse terminology.)  Either way, it can be improved somewhat.  Currently, it says--

"* On input, if newline is None,... Lines in the input can end in '\n', '\r', or '\r\n', and these are translated into '\n' before being returned to the caller...
* On output, if newline is None, any '\n' characters written are translated to the system default line separator, os.linesep..."

(from http://docs.python.org/dev/library/io.html#io.TextIOWrapper )

It is somewhat confusing because "On input" does not mean "On input to the buffer," and "On output" does not mean "On output from the buffer."  It is the reverse.

A minimal change to address this would be something along the lines of--

"On input" -> "When reading input from the buffer"
"On output" -> "When writing output to the buffer

The same change could also be made to the open() documentation:

http://docs.python.org/dev/library/functions.html#open

I can prepare a patch for affected versions.
msg167996 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-08-11 19:15
Andrew, I'm adding you because this is the documentation that the subprocess module will point to after issue 15561.
msg168074 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2012-08-13 09:43
For me input means «reading from» and output — «writing to».

Nevertheless I'm ok with you suggestion.
msg168075 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-08-13 10:00
New changeset 5b629e9fde61 by Andrew Svetlov in branch '3.2':
Issue #15624: clarify newline documentation for open and io.TextIOWrapper
http://hg.python.org/cpython/rev/5b629e9fde61

New changeset 9e098890ea2c by Andrew Svetlov in branch 'default':
Issue #15624: clarify newline documentation for open and io.TextIOWrapper
http://hg.python.org/cpython/rev/9e098890ea2c
msg168076 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2012-08-13 10:00
Close as fixed. Thanks.
msg168079 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-08-13 11:29
Thanks a lot, Andrew.
History
Date User Action Args
2022-04-11 14:57:34adminsetgithub: 59829
2012-08-13 11:29:26chris.jerdoneksetmessages: + msg168079
2012-08-13 10:00:56asvetlovsetstatus: open -> closed
versions: + Python 3.2, Python 3.3
messages: + msg168076

resolution: fixed
stage: resolved
2012-08-13 10:00:05python-devsetnosy: + python-dev
messages: + msg168075
2012-08-13 09:57:15asvetlovsettitle: clarify io.TextIOWrapper newline documentation -> clarify newline documentation for open and io.TextIOWrapper.
2012-08-13 09:43:57asvetlovsetmessages: + msg168074
2012-08-11 19:15:26chris.jerdoneksetnosy: + asvetlov
messages: + msg167996
2012-08-11 19:14:23chris.jerdonekcreate