文件名称:特殊实例属性-qt教学大纲
文件大小:5.26MB
文件格式:PDF
更新时间:2021-06-04 01:59:54
python 核心编程 中文版 高清文字版 表 13.2 特殊实例属性 I.__class__ 实例化 I的类 I.__dict__ I 的属性 现在使用类 C及其实例 C来看看这些特殊实例属性: >>> class C(object): # define class 定义类 ... pass ... >>> c = C() # create instance 创建实例 >>> dir(c) # instance has no attributes 实例还没有属性 [] >>> c.__dict__ # yep, definitely no attributes 也没有属性 {} >>> c.__class__ # class that instantiated us 实例化 c的类