【发布时间】:2012-05-21 12:21:57
【问题描述】:
我正在尝试查找有关 Python 基类的更多信息:object,但找不到任何信息。它只是像class object: pass 这样不值得更多关注还是......?
我在哪里可以找到更多关于它的信息。其他类从它继承了什么?
【问题讨论】:
标签: python class inheritance
我正在尝试查找有关 Python 基类的更多信息:object,但找不到任何信息。它只是像class object: pass 这样不值得更多关注还是......?
我在哪里可以找到更多关于它的信息。其他类从它继承了什么?
【问题讨论】:
标签: python class inheritance
here 有一些很好的信息(以及从那里链接的其他文章)。示意图如下:
【讨论】:
一些基本的东西供其他对象使用。
>>> dir(object())
['__class__', '__delattr__', '__doc__', '__format__', '__getattribute__',
'__hash__', '__init__', '__new__', '__reduce__', '__reduce_ex__', '__repr__',
'__setattr__', '__sizeof__', '__str__', '__subclasshook__']
有关这些方法的更多信息,请查看http://docs.python.org/reference/datamodel.html,以及它们的实现方式http://hg.python.org/cpython/file/3d4d52e47431/Objects/object.c。
【讨论】: