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: Docs: double newlines printed in some file iteration examples
Type: enhancement Stage: resolved
Components: Documentation Versions: Python 3.3, Python 3.4, Python 3.5, Python 2.7
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: docs@python Nosy List: asvetlov, docs@python, lost-theory, terry.reedy
Priority: normal Keywords: patch

Created on 2012-12-03 03:41 by lost-theory, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
r80699.patch lost-theory, 2012-12-03 03:41 patch for 'default' branch review
r80694.py27.patch lost-theory, 2012-12-03 03:43 patch for '2.7' branch review
Repositories containing patches
https://bitbucket.org/lost_theory/cpython/
Messages (2)
msg176824 - (view) Author: Steven Kryskalla (lost-theory) Date: 2012-12-03 03:41
I heard someone complain about this code appearing in the official documentation in a few places:

for line in open("file.txt"):
    print(line)

This code will print two newlines.

I went through the current "default" and "2.7" branches and changed the places where this occurred to use print(line, end="") for 3.x or "print line," for 2.x.

r80699.patch is for the "default" branch (3.x)
r80694.py27.patch is for the "2.7" branch
msg177161 - (view) Author: Andrew Svetlov (asvetlov) * (Python committer) Date: 2012-12-08 16:05
Committed, except whatsnew files.
That ones should be untouched from my perspective — the issue is not bugfix but improvement and I see no reason why we need to backedit whatsnew for old outdated versions.
Changesetes fed7306f26ce, 268ead8ae46b, 9e4b003a4d7a, 29627bd5b333.
Thanks for patches!
History
Date User Action Args
2022-04-11 14:57:39adminsetgithub: 60802
2012-12-08 16:05:17asvetlovsetstatus: open -> closed

nosy: + asvetlov
messages: + msg177161

resolution: fixed
stage: resolved
2012-12-08 05:25:45terry.reedysetnosy: + terry.reedy
2012-12-03 03:43:21lost-theorysetfiles: + r80694.py27.patch
2012-12-03 03:43:01lost-theorysetfiles: - r80699.patch
2012-12-03 03:42:28lost-theorysetfiles: + r80699.patch
versions: + Python 2.7
2012-12-03 03:41:42lost-theorycreate