Py2 Classical Class, inheritance problem

class A ():

def __init__(self):
    print("A")

class B (A):

def __init__(self):
    super(B, self).__init__()

b = B ()
* * an error occurred when executing under py2
super (B, self). _ init__ ()
TypeError: must be type, not classobj**

there is no problem if parent class A uses the new class
class A (object):

def __init__(self):
    print("A")

Why!?

Mar.10,2021

python.org/2/library/functions.html?highlight=super-sharpsuper" rel=" nofollow noreferrer "> super description

super (type [, object-or-type])

Note: super () only works for new-style classes.


I don't know the nuances between Python2 and Python3, but I think there's something wrong with your inheritance.

super(B, self).__init__()

Why do you inherit class B under custom class B? Let B be both a son and a father, go against the laws of nature and affirm Error. As said on the first floor: "super () only works for new-style classes."

maybe I misunderstood it. If there are any mistakes, please don't be stingy and guide me to correct them.

MySQL Query : SELECT * FROM `codeshelper`.`v9_news` WHERE status=99 AND catid='6' ORDER BY rand() LIMIT 5
MySQL Error : Disk full (/tmp/#sql-temptable-64f5-1bf3443-54ac1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
MySQL Errno : 1021
Message : Disk full (/tmp/#sql-temptable-64f5-1bf3443-54ac1.MAI); waiting for someone to free some space... (errno: 28 "No space left on device")
Need Help?