super() fails with error: TypeError “argument 1 must be type, not classobj” when parent does not inherit from object

Your problem is that class B is not declared as a “new-style” class. Change it like so: class B(object): and it will work. super() and all subclass/superclass stuff only works with new-style classes. I recommend you get in the habit of always typing that (object) on any class definition to make sure it is a … Read more

super() in Java

super() calls the parent constructor with no arguments. It can be used also with arguments. I.e. super(argument1) and it will call the constructor that accepts 1 parameter of the type of argument1 (if exists). Also it can be used to call methods from the parent. I.e. super.aMethod() More info and tutorial here

Calling parent class __init__ with multiple inheritance, what’s the right way?

The answer to your question depends on one very important aspect: Are your base classes designed for multiple inheritance? There are 3 different scenarios: The base classes are unrelated, standalone classes. If your base classes are separate entities that are capable of functioning independently and they don’t know each other, they’re not designed for multiple … Read more

super() raises “TypeError: must be type, not classobj” for new-style class

Alright, it’s the usual “super() cannot be used with an old-style class”. However, the important point is that the correct test for “is this a new-style instance (i.e. object)?” is >>> class OldStyle: pass >>> instance = OldStyle() >>> issubclass(instance.__class__, object) False and not (as in the question): >>> isinstance(instance, object) True For classes, the … Read more

What does ‘super’ do in Python? – difference between super().__init__() and explicit superclass __init__()

What’s the difference? SomeBaseClass.__init__(self) means to call SomeBaseClass‘s __init__. while super().__init__() means to call a bound __init__ from the parent class that follows SomeBaseClass‘s child class (the one that defines this method) in the instance’s Method Resolution Order (MRO). If the instance is a subclass of this child class, there may be a different parent … Read more

Understanding Python super() with __init__() methods [duplicate]

super() lets you avoid referring to the base class explicitly, which can be nice. But the main advantage comes with multiple inheritance, where all sorts of fun stuff can happen. See the standard docs on super if you haven’t already. Note that the syntax changed in Python 3.0: you can just say super().__init__() instead of … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)