+ 1

super() of super() in multiple level class inheritance

Consider class inheritance in the levels with same method: class A: def method(self): ... class B(A): def method(self): ... class C(B): def method(self): super().method() Here super().method() refers to method of class B. Is it possible to refer to method of class A directly from C?

11th Jul 2016, 1:43 PM
Jesse P Francis
Jesse P Francis - avatar
7 Answers
+ 3
Oh sorry for not reading your code properly. You could try making another method for class C that directly calls the method from class A. def callA(self): A.method ()
11th Jul 2016, 4:15 PM
Gershon Fosu
Gershon Fosu - avatar
+ 2
It still the case since C inherited A aswell as B. objectofC.methodofA()
11th Jul 2016, 3:34 PM
Gershon Fosu
Gershon Fosu - avatar
+ 1
you can add super(). method() in the B.Method() so when you call super(). method() of the C object it call the method of B and the latter recursively calls the method of its super class A.
22nd Aug 2016, 3:59 PM
Ahmed chiboub
Ahmed chiboub - avatar
0
.Amethod () ...
11th Jul 2016, 3:00 PM
Gershon Fosu
Gershon Fosu - avatar
0
/
23rd Jul 2016, 2:25 PM
darkonian L.
darkonian L. - avatar
- 1
@Gershon, well, from an object of C?
11th Jul 2016, 3:16 PM
Jesse P Francis
Jesse P Francis - avatar
- 1
nope method is already over written in class b
11th Jul 2016, 4:00 PM
Nitin Lakhwani
Nitin Lakhwani - avatar