pythonのお勉強 例外処理

try〜except〜finalyで記述
raise句で呼び出し元に例外を通知

#! /usr/bin/python
# coding: utf-8

def test( arg1, arg2 ):
    ret = 0
    try:
        ret = arg1 + arg2
    except:
        print "exception"
        #例外を送信
        raise
    finally:
        print "finaly"
    return ret

try:
    print test( 1, 4)
    print test( "hoge", "foo")
    #raise(例外)を受け取る
    print test( 1, "foo" )
except:                                                                                                               
    print "error"
#output
finaly
5
finaly
hogefoo
exception
finaly
error