I am reading a brief intro to exception handling in Mark Summerfield's "Programming in Python 3, 2nd ed." He gives the basic syntax as:
try: try_suite except exception1 as variable1: exception_suite1 ... except exceptionN as variableN: exception_suiteN My current understanding is that exception1, ... , exceptionN should match one of Python's exception classes or subclasses in order to perform a match and execute the corresponding exception suite. I found this in the docs: Exceptions are identified by class instances. The except clause is selected depending on the class of the instance: it must reference the class of the instance or a base class thereof. The instance can be received by the handler and can carry additional information about the exceptional condition. Note Exception messages are not part of the Python API. Their contents may change from one version of Python to the next without warning and should not be relied on by code which will run under multiple versions of the interpreter. I have so far been unable to find a list of these class/subclass names. Of course I can force an error to occur in the interpreter and see what comes up for each type of error I wish to catch. Is there such a table or list? -- boB
_______________________________________________ Tutor maillist - Tutor@python.org To unsubscribe or change subscription options: https://mail.python.org/mailman/listinfo/tutor