advice on programming style: is multiple inheritance bad?

Uwe Mayer merkosh at
Tue Feb 3 15:57:24 CET 2004

Michael Hudson wrote:

> Uwe Mayer <merkosh at> writes:
>> BTW: when doing m.i. you can't mix new-style and old-style objects, or
>> else Python exits with a Segmentation Fault. :)
> Uhh, really?  Example please.

Seems only to occur in connection with Qt. :( 
Code as the one below, inheriting from some Qt Widget and using m.i. with
new-style classes cause a Segmentation Fault on my machine:

-- example --
from qt import QWidget, QApplication
import sys

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

class B(object):
    def __init__(self):
        print "in B"

class C(QWidget,A):
    def __init__(self):
        print "in C"

class D(QWidget,B):
    def __init__(self):

app = QApplication(sys.argv)
C() #works
D() #fails
-- example --


More information about the Python-list mailing list