Lars <[email protected]> added the comment:
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?
----------
nosy: +farcat
_______________________________________
Python tracker <[email protected]>
<http://bugs.python.org/issue672115>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com