Author farcat
Recipients farcat, glchapman, lorph, mwh
Date 2009-04-21.09:13:21
SpamBayes Score 1.17004e-09
Marked as misclassified No
Message-id <>
in my project i need to be able to let the user dynamically make and
remove inheritance relationships between classes and in my testing i
think i have run into this issue assigning to __bases__. the

class object(object):

trick seems to work, but i can't really oversee the consequenses. I also
saw another variation which might be the same issue:

    A= type("A", (object,), {'one': 1})
    B= type("B", (object,), {'two': 2})
    C= type("C", (object,), {'three': 3})

    A = type("A",(A,B),{})
    print dir(A)
    print A.__bases__
    print '-----------------------------------'
    A.__bases__ = (B,C)
    print dir(A)
    print A.__bases__
    print '-----------------------------------'

no exceptions, but the second dir(A) shows that A has lost its attribute

if the class object(object) trick is not safe, is there a way to get the
dynamic inheritance behaviour in another way, e.g. through metaclasses?
Date User Action Args
2009-04-21 09:13:24farcatsetrecipients: + farcat, mwh, glchapman, lorph
2009-04-21 09:13:24farcatsetmessageid: <>
2009-04-21 09:13:22farcatlinkissue672115 messages
2009-04-21 09:13:22farcatcreate