[New-bugs-announce] [issue3503] Calls to print() function in Python 3.0 tutorial

Jim Sizelove report at bugs.python.org
Tue Aug 5 03:51:04 CEST 2008

New submission from Jim Sizelove <jimsize at gmail.com>:

I decided to learn more about the coming changes in Python 3.0 by
installing the beta and working through the tutorial.  I found some
discrepancies between the code examples and the output I got.  The
attached patch shows several places where the print() function is called
incorrectly.  These are mostly examples that are missing the parentheses.

The rest of this comment pertains to only one change included in the
patch that I find less than satisfactory.  In introduction.html, there
is an example of printing a fibonacci sequence in one line of output by
using the end keyword.  When actually run in the python interpreter, the
>>> prompt shows at the end of the same line as the fibonacci numbers. 
The patch fixes this by enclosing a "print()" within an else clause.

This "fix" produces the expected output, but I don't think the else
clause has been described yet in the tutorial.  A better fix would be to
wrap the while statement in a function with a print() function call
after the end of the while statement (this is how the fib() function is
defined in http://docs.python.org/dev/3.0/tutorial/modules.html).  But
functions have not been explained this early in the tutorial.

Perhaps it would be best to drop this example of using the end keyword
to the print function in the introduction and explain it later in the

assignee: georg.brandl
components: Documentation
files: print.diff
keywords: patch
messages: 70727
nosy: georg.brandl, jsizelove
severity: normal
status: open
title: Calls to print() function in Python 3.0 tutorial
versions: Python 3.0
Added file: http://bugs.python.org/file11061/print.diff

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list