I found that a method in the second base class was not called when there was another base class in front of the second one. It seems that the first base class overrides the second one even when the first one has no method
Following is the code I tested:
class BaseClassA:
def __init__(self, text):
print('in __init__ in BaseClassA')
self.text= text
class BaseClassB:
pass
class ClassC(BaseClassB, BaseClassA):
pass
def main():
obj= ClassC('hello')
print('obj.text= ', obj.text)
if __name__ == '__main__':
main()
The output in CPython:
in __init__ in BaseClassA
obj.text= hello
The output in Transcrypt:
obj.text= None
I think that the first base class should override ONLY WHEN it has a method. It looks like a bug in class inheritance.
Hi.
I found that a method in the second base class was not called when there was another base class in front of the second one. It seems that the first base class overrides the second one even when the first one has no method
Following is the code I tested:
The output in CPython:
The output in Transcrypt:
I think that the first base class should override ONLY WHEN it has a method. It looks like a bug in class inheritance.
Thanks.