Execute the code, there is an error, Typeerror:must is type, not classobj
Class A ():
def __init__ (self):
Print ("Enter A")
Print ("Leave A")
Class B (A):
def __init__ (self):
Print ("Enter B")
Super (B, self). __init__ ()
Print ("Leave B")
Class C (A):
def __init__ (self):
Print ("Enter C")
Super (C, self). __init__ ()
Print ("Leave C")
Class D (A):
def __init__ (self):
Print ("Enter D")
Super (D, self). __init__ ()
Print ("Leave D")
Class E (B, C, D):
def __init__ (self):
Print ("Enter E")
Super (E, self). __init__ ()
Print ("Leave E")
E ()
Output error:
Traceback (most recent):
File "f:/test5.py", line A, in <module>
E ()
File "f:/test5.py", line +, in __init__
Super (E, self). __init__ ()
Typeerror:must is type, not classobj
Baidu later found that the Python super can only be applied to the new class, but not to the classic class
See: http://blog.csdn.net/andos/article/details/8973368
Normal after using the new class (that is, a inherits from object).
This article is from the "Farley" blog, make sure to keep this source http://10250691.blog.51cto.com/10240691/1851741
Typeerror:must be type of super in Python, not classobj cause and resolution