[docs] [issue22170] Typo in iterator doc

R. David Murray report at bugs.python.org
Fri Aug 8 15:35:55 CEST 2014


R. David Murray added the comment:

The comma means print doesn't add a newline to what is printed.  This is correct because the lines read from the file already have a newline at the end.  I can see how this example becomes a little confusing in a tutorial section on iterators, but as Mark said, if you try it, you find out that it works, and if you play with removing the comma you learn things about how python works with files (I don't remember how much of that is covered earlier in the tutorial).

In python3 this is clearer, because the equivalent line uses end='', making it clearer that it is intentional and meaningful.

Except...that in the python3 tutorial it currently *doesn't* use end='', so that example is in fact wrong and needs to be fixed :)

----------
nosy: +r.david.murray
stage:  -> needs patch
type: enhancement -> behavior
versions: +Python 3.4, Python 3.5 -Python 2.7

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22170>
_______________________________________


More information about the docs mailing list