classification
Title: Python 2.5 Documentation error in Tutorial section 8.3
Type: Stage:
Components: Documentation Versions: Python 2.5
process
Status: closed Resolution: works for me
Dependencies: Superseder:
Assigned To: georg.brandl Nosy List: amaury.forgeotdarc, dcw303, georg.brandl
Priority: normal Keywords:

Created on 2008-05-24 03:08 by dcw303, last changed 2008-05-24 13:00 by georg.brandl. This issue is now closed.

Messages (3)
msg67281 - (view) Author: Daniel Crowley-Wilson (dcw303) Date: 2008-05-24 03:07
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..."
...
msg67294 - (view) Author: Amaury Forgeot d'Arc (amaury.forgeotdarc) * (Python committer) Date: 2008-05-24 12:51
What makes you think that the code does not match the description?
msg67298 - (view) Author: Georg Brandl (georg.brandl) * (Python committer) Date: 2008-05-24 13:00
Closing as "works for me".
History
Date User Action Args
2008-05-24 13:00:15georg.brandlsetstatus: open -> closed
resolution: works for me
messages: + msg67298
2008-05-24 12:51:13amaury.forgeotdarcsetnosy: + amaury.forgeotdarc
messages: + msg67294
2008-05-24 03:08:10dcw303create