在我过去的一个问题中,回答者告诉我,当你想创建的类是从头开始的时候,最好从对象继承,而不需要从其他类继承。为什么继承对象类型
例如,像什么我总是这样:
class my_class:
"a class inherits from nothing"
def __init__(self):
pass
对于他或她建议:
class suggested_class(object):
"a class inherits from object type"
def __init__(self):
pass
我很困惑与这两种方法的优点或缺点。
问题1:
那么,什么是你的想法,从对象类型或没有继承?
请参阅http://docs.python.org/release/2.2.3/whatsnew/sect-rellinks.html#SECTION000310000000000000000 – wim
正如Marcello提到的,如果您有两个问题,请将此帖子限制为单个问题,并且[发布另一个问题](http://stackoverflow.com/questions/ask)。 – SingleNegationElimination
你可以看看'dir(my_class)'和'dir(suggested_class)'。此外,如下所述,在Python3中两者都是相同的。 – steabert