[Tutor] Question about exception

Mike Hansen Mike.Hansen at atmel.com
Thu Apr 5 21:48:15 CEST 2007


When doing a try/except block, is it possible to return a list as part
of the exception?

try:
    check_someting()
except CheckSomethingError, e:
    for each_error in e:
       # do something

Can 'e' be a list of errors? If so, how do you construct your exception
class?


Is it better to do it like this?

(errors) = check_something()
if errors:
   # do something 
 

Mike "head zoned out due to allergies"   


More information about the Tutor mailing list