[Tutor] Question about exception

Mike Hansen Mike.Hansen at atmel.com
Thu Apr 5 22:23:59 CEST 2007


> If the Exception is defined as a class, e will be an instance of
> that class so you can have pretty much anything available:
> 
> class MyException(Exception):
>     def __init__(self, msg, mylist)
>         self.msg = msg
>         self.mylist = mylist
>         Exception.__init__(self, msg)
> 
> try:
>     check_something()
> except MyException, e:
>     for entry in e.mylist: ...
> 
> Bill
> --
> INTERNET:   bill at Celestial.COM  Bill Campbell; Celestial Software LLC
> URL: http://www.celestial.com/  PO Box 820; 6641 E. Mercer Way
> FAX:            (206) 232-9186  Mercer Island, WA 98040-0820; 
> (206) 236-1676
> 
> ``I don't make jokes, I just watch the Government and report 
> the facts...''
>     Will Rogers

Doh! It was right in front of me, but I wasn't connecting the dots. 

Thanks,

Mike


More information about the Tutor mailing list