argument to make an instance for us exception instances can be created before the raiseas done hereor within the raise statement itself catching categories this code includes functions that raise instances of all three of our classes as exceptionsas well as top-level try that calls the functions and catches general exceptions the same try also catches the two specific exceptionsbecause they are subclasses of general--members of its category exception details the exception handler here uses the sys exc_info call--as we'll see in more detail in the next it' how we can grab hold of the most recently raised exception in generic fashion brieflythe first item in its result is the class of the exception raisedand the second is the actual instance raised in general except clause like the one here that catches all classes in categorysys exc_info is one way to determine exactly what' occurred in this particular caseit' equivalent to fetching the instance' __class__ attribute as we'll see in the next the sys exc_info scheme is also commonly used with empty except clauses that catch everything the last point merits further explanation when an exception is caughtwe can be sure that the instance raised is an instance of the class listed in the exceptor one of its more specific subclasses because of thisthe __class__ attribute of the instance also gives the exception type the following variant in classexc pyfor exampleworks the same as the prior example--it uses the as extension in its except clause to assign variable to the instance actually raisedclass general(exception)pass class specific (general)pass class specific (general)pass def raiser ()raise general(def raiser ()raise specific (def raiser ()raise specific (for func in (raiser raiser raiser )tryfunc(except general as xprint('caught%sx __class__x is the raised instance same as sys exc_info()[ because __class__ can be used like this to determine the specific type of exception raisedsys exc_info is more useful for empty except clauses that do not otherwise have way to access the instance or its class furthermoremore realistic programs usually should not have to care about which specific exception was raised at all--by calling methods of the exception class instance genericallywe automatically dispatch to behavior tailored for the exception raised exceptionsback to the future