I have a problem with understanding function super() behavior in abc.ABCMeta class in python3.6.
class ParentClass():
def test():
return 1
@six.add_metaclass(ABCMeta)
class ChildClass(ParentClass):
def test(self):
test_ = super().test
test_ = 2
return test_
a = ChildClass()
a.test()
Code failed with 'TypeError: super(type, obj): obj must be an instance or subtype of type'
.
When I used super(ChildClass, self).test
it worked correctly! Printing from ChildClass test function:
print(__class__)
print(type(__class__))
print(ChildClass)
print(type(ChildClass))
I get next output:
<class '__main__.ChildClass'>
<class 'type'>
<class '__main__.ChildClass'>
<class 'abc.ABCMeta'>
I feel that the reason in object initialization but I can't undersand this information with my current skills in OOP and Python OOP.