There is a simple program in python3:
from PyQt4 import QtCore
import PyQt4
class Bar(object):
def __init__(self):
print("Bar start")
super(Bar, self).__init__()
print("Bar end")
class FakeQObject(object):
def __init__(self):
print("FakeQObject start")
super(FakeQObject, self).__init__()
print("FakeQObject end")
class Foo(QtCore.QObject, Bar):
#class Foo(FakeQObject, Bar):
def __init__(self):
print("Foo start")
super(Foo, self).__init__()
print("Foo end")
print(Foo.__mro__)
print(PyQt4.QtCore.PYQT_VERSION_STR)
f = Foo()
a) When class Foo inherits from QtCore.QObject and Bar we get:
(<class '__main__.Foo'>, <class 'PyQt4.QtCore.QObject'>, <class 'sip.wrapper'>, <class 'sip.simplewrapper'>, <class '__main__.Bar'>, <class 'object'>)
4.9.4
Foo start
Foo end
b) When class Foo inherits from FakeQObject and Bar we get:
(<class '__main__.Foo'>, <class '__main__.FakeQObject'>, <class '__main__.Bar'>, <class 'object'>)
4.9.4
Foo start
FakeQObject start
Bar start
Bar end
FakeQObject end
Foo end
The question is: why in the a) case, Bar init is not called?
I found similar question here pyQt4 and inheritance but there are no good answers.
Thanks in advance!