Exceptions

Tetsuo member16943 at dbforums.com
Mon Feb 3 15:34:08 EST 2003


So I create functions as methods of a class, then try them?

I'll try it out when I get home some day... But I'll guess now.

class CorruptHardDiskError(Exception):
    def Pythagoras(a,b):
        print (a**2 + b**2)**(1/2)

try:
    Pythagoras(18, "x")
except CorruptHardDiskError:
    print "Wow"

--
Posted via http://dbforums.com




More information about the Python-list mailing list