浙江省高等学校教师教育理论培训

微信搜索“毛凌志岗前心得”小程序

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

Standard Exception Classes in Python 1.5

Fatal Breakage

More serious is breaking error handling code. This usually happens because the error handling code expects the exception or the value associated with the exception to have a particular type (usually string or tuple). With the new scheme, the type is a class and the value is a class instance. For example, the following code will break:

try:
    raise Exception()
except:
    print "Sorry:", sys.exc_type + ":", sys.exc_value
posted on 2012-11-26 14:00  lexus  阅读(209)  评论(0)    收藏  举报