Exception question

Ron Adam rrr at ronadam.com
Sat May 14 23:05:39 EDT 2005


I'm trying to understand exception handling better and have a question I 
haven't been able to find an answer too.  Which probably means It won't 
work, but...

Do exceptions that take place get stored in a stack or list someplace?

For example in:

try:
     try:
         try:
             riskyfunc()
             # error 1
         except:
             pass
         crazyclass()
         # error 2
     except:
         pass
     iffycalc()
     # error 3
except:
     pass

# print any errors that occurred here.


If errors 1,2,and 3 are possible errors, can I get
a list of them, or can I only see the last one?

I know I can catch the error and store it myself with,

     except Exception, exc:

or possibly,

     errlist = []
     errlist.append(sys.exc_info())

But what I want to know is does the interpreter do that in any way?  And 
if so, can I access it?

Cheers,
_Ron_Adam






More information about the Python-list mailing list