繁体   English   中英

错误=类DBError(exceptions.Exception)(做`help('dbhash')`),这种语言构造体叫什么?

[英]error = class DBError(exceptions.Exception) (do `help('dbhash')`), what is this language construct called?

help('dbhash') (标准库模块):

CLASSES
    exceptions.Exception(exceptions.BaseException)
        bsddb.db.DBError

    error = class DBError(exceptions.Exception)
     |  Method resolution order:
     |      DBError
     |      exceptions.Exception
     |      exceptions.BaseException
     |      __builtin__.object
     :

error = class DBError(exceptions.Exception)语言构造如何调用? 它有什么作用? 如果安装了django,则在执行help('django.http.HttpResponse')时,可以看到此构造的另一个示例。

(我正在使用python 2.7.2和django 1.4)

这不是有效的语法。 在帮助中,这意味着要表示该error最初定义为class DBError并且是从exceptions.Exception派生的。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM