super() fails with error: TypeError “argument 1 must be type, not classobj” when parent does not inherit from object
I get some error that I can’t figure out. Any clue what is wrong with my sample code? class B: def meth(self, arg): … Read more
I get some error that I can’t figure out. Any clue what is wrong with my sample code? class B: def meth(self, arg): … Read more
Is super() used to call the parent constructor? Please explain super(). 17 Answers 17
Say I have a multiple inheritance scenario: class A(object): # code for A here class B(object): # code for B here class C(A, … Read more
The following use of super() raises a TypeError: why? >>> from HTMLParser import HTMLParser >>> class TextParser(HTMLParser): … def __init__(self): … super(TextParser, self).__init__() … Read more
What’s the difference between: class Child(SomeBaseClass): def __init__(self): super(Child, self).__init__() and: class Child(SomeBaseClass): def __init__(self): SomeBaseClass.__init__(self) I’ve seen super being used quite a … Read more
I came across PECS (short for Producer extends and Consumer super) while reading up on generics. Can someone explain to me how to … Read more
This question already has answers here: What does ‘super’ do in Python? – difference between super().__init__() and explicit superclass __init__() (11 answers) Closed … Read more