This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author dcw303
Recipients dcw303, georg.brandl
Date 2008-05-24.03:07:50
SpamBayes Score 0.011548402
Marked as misclassified No
Message-id <1211598495.79.0.572068175443.issue2955@psf.upfronthosting.co.za>
In-reply-to
Content
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..."
...
History
Date User Action Args
2008-05-24 03:08:28dcw303setspambayes_score: 0.0115484 -> 0.011548402
recipients: + dcw303, georg.brandl
2008-05-24 03:08:18dcw303setspambayes_score: 0.0115484 -> 0.0115484
messageid: <1211598495.79.0.572068175443.issue2955@psf.upfronthosting.co.za>
2008-05-24 03:08:10dcw303linkissue2955 messages
2008-05-24 03:08:08dcw303create