[Tutor] a question about exceptions

Tony Cappellini tony at tcapp.com
Mon Mar 22 03:24:29 EST 2004



Recently,

I've found this code on the net- I think it was from the Python Cookbook.

         try:
            Celsius=float(string.atoi(CTemp))
         except string.atoi_error:
            print repr(CTemp), "not a numeric value"
         else:


I understand what's happening-in general. What I don't understand is the 
exception type
string.atoi_error.

Where is this type of exception defined ? I couldn't find anything on 
exceptions other than the built-in exception classes, in the Python docs, 
and the books I have on Python.

So where is this type of exception defined and documented ? What other 
kinds of exception types like this exist ?

This type of exception handling opens up a whole lot of possibilities, if I 
could only find out where to get documentation.

thanks

Tony 
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20040322/ebbd1924/attachment.html


More information about the Tutor mailing list