Issue 2955: Python 2.5 Documentation error in Tutorial section 8.3
Issue2955
Created on 2008-05-24 03:08 by dcw303, last changed 2022-04-11 14:56 by admin. 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) * ![]() |
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) * ![]() |
Date: 2008-05-24 13:00 | |
Closing as "works for me". |
|||
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2022-04-11 14:56:34 | admin | set | github: 47204 |
| 2008-05-24 13:00:15 | georg.brandl | set | status: open -> closed resolution: works for me messages: + msg67298 |
| 2008-05-24 12:51:13 | amaury.forgeotdarc | set | nosy:
+ amaury.forgeotdarc messages: + msg67294 |
| 2008-05-24 03:08:10 | dcw303 | create | |
