2012-05-21 21 views

回答

3

有一些很好的信息here(和從那裏鏈接的其他文章)。下面是圖:

enter image description here

+0

我認爲這裏的圖(底部)是更好的:http://www.cafepy.com/article/python_types_and_objects/python_types_and_objects。 html – jamylak

+1

@jamylak:我喜歡那篇文章,但是這個圖表是不完整的,因爲它沒有涉及定製元類,而IMO是重要的。此外,我發現「繼承」和「類型」行之間的視覺差異不夠清晰 –

2

其他對象使用的一些基本東西。

>>> 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

+0

我的意思,更重要的是:) – JohnDoDo

相關問題