Message86225
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):
pass
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
'one'
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:24 | farcat | set | recipients:
+ farcat, mwh, glchapman, lorph |
2009-04-21 09:13:24 | farcat | set | messageid: <1240305204.03.0.59118555223.issue672115@psf.upfronthosting.co.za> |
2009-04-21 09:13:22 | farcat | link | issue672115 messages |
2009-04-21 09:13:22 | farcat | create | |
|