newb: Question regarding custom exception

crybaby joemystery123 at gmail.com
Sun Sep 23 08:32:28 EDT 2007


Why you specify type and name of the exception in your custom
exceptions,
but not in built in exceptions

    except IOError:
        print "no file by the name ccy_rates*.txt"

    except MyError, e:
                print e.msg

Also, when you do:

try: raise MyError(23)

In "try: MyError(23) ", you are calling MyError class, but actually
get instantiated in except MyError, e: ?




More information about the Python-list mailing list