xia*_*012 7 python inheritance object python-2.7
在我过去的一个问题中,一个回答者告诉我,当你想要创建的类是从头开始时,从对象继承是更好的,这不需要从其他类继承.
例如,像我一直做的那样:
class my_class:
"a class inherits from nothing"
def __init__(self):
pass
Run Code Online (Sandbox Code Playgroud)
对于他或她的建议:
class suggested_class(object):
"a class inherits from object type"
def __init__(self):
pass
Run Code Online (Sandbox Code Playgroud)
我对这两种方法的好处或缺点感到困惑.
问题1:
那么你的想法是什么,从对象类型继承还是什么都没有?