class A:
pass
class A(object):
pass
注: 在Python 3.x中没有新式类和老式类之分,它们都继承自'object' 类。因此可以不用显示地指定其基类。'object'基类中拥有的方法和属性可通用于所有的新式类。
class A(object):
def __init__(self):
print "A.__init__ called" # -> is actually never called
def __new__(cls):
print "A.__new__ called"
# return super(cls, cls).__new__(cls) # return object.__new__(cls) # 此两种会执行 __init__
print A()