File: class/Workbook/Examples/Lecture8/nestexc.py

def action2():
    print 1 + []           # generate TypeError

def action1():
    try:
        action2()
    except TypeError:      # most recent matching try
        print 'inner try'

try:
    action1()
except TypeError:          # here iff action1 re-raises
    print 'outer try'



[Home page] Books Code Blog Python Author Train Find ©M.Lutz