[issue10304] error in tutorial triple-string example

Malte Helmert report at bugs.python.org
Fri Nov 5 23:37:20 CET 2010


Malte Helmert <helmert at informatik.uni-freiburg.de> added the comment:

> 1. Rather than add a blank line to the output, the input should have
> the newline suppressed with \ (which has been done in previous
> examples).
> print("""\

I think that would be didactically bad after just mentioning that newlines in triple-quoted strings don't have to be escaped etc.
I think this would confuse the reader.

Better use print("""Usage...


> In interactive use, the interpreter will go to a new line anyway
> before printing the >>> prompt.

It won't (at least in Python 3.1). I just tried it.

> The intent and effect of end=' ' is that the outputs are all on one
> line (as with 2.x print) instead of each on a separate line

Sure. But I think that in an example that is essentially about whitespace produced by print, the actual whitespace in the output should match the actual behaviour of print. One why to get rid of this problem altogether is to add a 'print "done!"' or whatever at the end, or use a different separator from " ".

----------

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


More information about the Python-bugs-list mailing list