You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
Thanks.
The text was updated successfully, but these errors were encountered:
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.
The text was updated successfully, but these errors were encountered: