PYTHON3.0 does not exist, the old version may have an error:
Class A ():
def __init__ (self):
print (' A ')
class B ():
def __init__ (self):
print (' B ')
class C ():
def __init__ (self):
print (' C ')
class Asub (A):
def __init__ (self):
print (' asub ')
Super (asub, self). __init__ ()
class BSub (B):
def __init__ (self):
print (' BSub ')
super (bsub,self ). __init__ ()
class Csub (C):
def __init__ (self):
print (' csub ')
super (csub, self). __init__ ()
class E (Asub, BSub, csub):
def __init__ (self):
print (' E ')
asub.__init__ (self)
bsub.__ Init__ (self)
csub.__init__ (self)
d = E ()
The
error occurred while calling super initialization in subclass Asub: Where A is a superclass, there is no syntax error in careful examination. Super (asub, self). Init () typeerror:super () Argument 1 must is type, not classobj for the following reasons: The method of calling the superclass directly before the python2.2 version was later changed to be called by Super, because of the resolution of the diamond in multiple inheritance Shape problems. Super in Python can only be used in new classes, not in previous classic classes, and this error occurs if the base class is a classic class. The solution is to asub as long as there is an object on the superclass OK. For example: A (object): .......
Class A (object): #!!!!!!! Based in Object!!!!!!
def __init__ (self):
print (' A ')
class B (object):
def __init__ (self):
print (' B ')
class C (object) :
def __init__ (self):
print (' C ')
class Asub (A):
def __init__ (self):
print (' asub ')
super (Asub, self). __init__ ()
class BSub (B):
def __init__ (self):
print (' BSub ')
super (bsub,self). __ INIT__ ()
class Csub (C):
def __init__ (self):
print (' csub ')
super (csub, self). __init__ ()
Class E (Asub, BSub, csub):
def __init__ (self):
print (' E ')
asub.__init__ (self)
bsub.__init__ ( Self)
csub.__init__ (self)
d = E ()
Note: When constructing a class, it is customary to inherit the base class object!!!