class General(Exception): pass
class Specific1(General): pass
class Specific2(General): pass

def raiser0(): raise General()
def raiser1(): raise Specific1()
def raiser2(): raise Specific2()

for func in (raiser0, raiser1, raiser2):
    try:
        func()
    except General as X:                       # X to zgłoszona instancja
        print('przechwycono:', type(X))        # To samo co sys.exc_info()[0], X.__class__
