[New-bugs-announce] [issue2955] Python 2.5 Documentation error in Tutorial section 8.3

Daniel Crowley-Wilson report at bugs.python.org
Sat May 24 05:08:18 CEST 2008

New submission from Daniel Crowley-Wilson <daniel.crowley.wilson at gmail.com>:

The code sample in Tutorial section 8.3 (Handling Exceptions) doesn't
match the description. Removing the "break" line from the code sample
would make the sample perform according to the description. Found in the
windows doc\python25.chm file.

Original text is below:


It is possible to write programs that handle selected exceptions. Look
at the following example, which asks the user for input until a valid
integer has been entered, but allows the user to interrupt the program
(using Control-C or whatever the operating system supports); note that a
user-generated interruption is signalled by raising the
KeyboardInterrupt exception. 

>>> while True:
...     try:
...         x = int(raw_input("Please enter a number: "))
...         break
...     except ValueError:
...         print "Oops!  That was no valid number.  Try again..."

assignee: georg.brandl
components: Documentation
messages: 67281
nosy: dcw303, georg.brandl
severity: normal
status: open
title: Python 2.5 Documentation error in Tutorial section 8.3
versions: Python 2.5

Tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list