I have a class BasicHandler , which is not abstract. I inherit from it when creating a Checker class with this constructor:

 def __init__(self): super(self.__class__, self).__init__() 

I made the Checker class abstract (maybe this is where the problem lies?) Like this:

 __metaclass__ = ABCMeta 

Next, I create a specific class SpecialChecker with a constructor:

 def __init__(self): super(self.__class__, self).__init__() 

As a result, when I run the script with the creation of an object of type SpecialChecker I get:

 RuntimeError: maximum recursion depth exceeded while calling a Python object 

What can be wrong ?

    2 answers 2

    I can be wrong, but the construction of the form

     super(self.__class__, self).__init__() 

    do not use, because self.__class__ will be the same in all base classes, respectively, and you get endless recursion.

      class C(object): def __init__(self): print(self.__class__) super(self.__class__, self).__init__() class D(C): def __init__(self): print(self.__class__) super(self.__class__, self).__init__() d = D() print d 
       from abc import ABCMeta class BasicHandler(object): def __init__(self):pass def foo(self):pass def bar(self):pass class Checker(BasicHandler): __metaclass__ = ABCMeta def __init__(self): super().__init__() # ok # super(self.__class__, self).__init__() # RuntimeError: maximum recursion depth exceeded while calling a Python object self.foo() class SpecialChecker(Checker): def __init__(self): super(self.__class__, self).__init__() self.foo() SpecialChecker()