classification
Title: Rephrase sentence in tutorial about universal newlines
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.2, Python 3.3, Python 3.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: asvetlov, chris.jerdonek, docs@python, fossilet, python-dev
Priority: normal Keywords: easy

Created on 2012-10-17 12:58 by fossilet, last changed 2012-10-18 03:33 by chris.jerdonek. This issue is now closed.

Messages (7)
msg173165 - (view) Author: Yongzhi Pan (fossilet) * Date: 2012-10-17 12:58
http://docs.python.org/py3k/tutorial/inputoutput.html#reading-and-writing-files

The text:

In text mode, the default is to convert platform-specific line endings (\n on Unix, \r\n on Windows) to just \n on reading and \n back to platform-specific line endings on writing. 

Is the last '\n' a typo and not needed?
msg173169 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2012-10-17 13:12
I'm not native English speaker, but for me it just means
\r\n -> \n when read from stream and
\n -> \r\n when write to stream
if OS is Windows.
That's correct.
msg173186 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-10-17 17:12
The last \n is needed for the reason Andrew mentioned, but it is true that the sentence could probably be rephrased to reduce the chance of confusion.
msg173187 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-10-17 17:40
I would suggest something like this:

"In text mode, the default when reading is to convert platform-specific line endings (\n on Unix, \r\n on Windows) to just \n.  When writing in text mode, the default is to convert occurrences of \n back to platform-specific line endings."
msg173192 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2012-10-17 18:38
Looks good to me, please apply it.
msg173227 - (view) Author: Roundup Robot (python-dev) (Python triager) Date: 2012-10-18 03:31
New changeset 7b2a13b20b33 by Chris Jerdonek in branch '3.2':
Clarify universal-newline wording in tutorial (issue #16266).
http://hg.python.org/cpython/rev/7b2a13b20b33

New changeset b5439bca219f by Chris Jerdonek in branch '3.3':
Merge from 3.2: clarify universal-newline wording in tutorial (issue #16266).
http://hg.python.org/cpython/rev/b5439bca219f

New changeset a45cb181e4d0 by Chris Jerdonek in branch 'default':
Merge from 3.3: clarify universal-newline wording in tutorial (issue #16266).
http://hg.python.org/cpython/rev/a45cb181e4d0
msg173228 - (view) Author: Chris Jerdonek (chris.jerdonek) * (Python committer) Date: 2012-10-18 03:33
Committed.  Thanks for the report!
History
Date User Action Args
2012-10-18 03:33:00chris.jerdoneksetstatus: open -> closed
type: behavior -> enhancement
messages: + msg173228

resolution: fixed
stage: resolved
2012-10-18 03:31:10python-devsetnosy: + python-dev
messages: + msg173227
2012-10-17 18:38:58asvetlovsetmessages: + msg173192
2012-10-17 17:40:14chris.jerdoneksetkeywords: + easy

title: Typo in tutorial -> Rephrase sentence in tutorial about universal newlines
messages: + msg173187
versions: + Python 3.4
2012-10-17 17:12:45chris.jerdoneksetmessages: + msg173186
2012-10-17 13:12:46asvetlovsetnosy: + asvetlov, chris.jerdonek
messages: + msg173169
2012-10-17 12:58:39fossiletcreate