title: Python mixins: object.__init__() takes no parameters
body: <p>I have a question related to Python mixin classes. This is my code:</p>
  
  <pre class="lang-py prettyprint-override"><code>class Base(object):
      def __init__(self, *args, **kwargs):
          print('Base; {}; {}'.format(args, kwargs))
          super().__init__(*args, **kwargs)
  
  
  class Mixin1(object):
      def __init__(self, *args, **kwargs):
          print('Mixin1; {}; {}'.format(args, kwargs))
          super().__init__(*args, **kwargs)
  
  
  class Mixin2(object):
      def __init__(self, *args, **kwargs):
          print('Mixin2; {}; {}'.format(args, kwargs))
          super().__init__(*args, **kwargs)
  
  
  class C(Mixin1, Mixin2, Base):
      pass
  </code></pre>
  
  <p>When I call <code>c = C(arg1=10, arg2=20)</code> I get the following error:</p>
  
  <pre><code>TypeError: object.__init__() takes no parameters
  </code></pre>
  
  <p>I understand why I get this error: <code>Base.__init__()</code> calls <code>super().__init__(*args, **kwargs)</code>, which is <code>object.__init__()</code> and doesn't accept any parameters. Is there a way to fix this in a clean way?</p>
  
  <p>One solution would be to omit the <code>*args</code> and <code>**kwargs</code> in the <code>Base</code> class and only call <code>super().__init__()</code>. But this fails if somebody writes <code>class C(Base, Mixin2): pass</code>. Another solution would be an <code>try ... except</code> clause around every <code>super()</code> call, which seems neither a good solution to me.</p>
  
  <p>Has anybody an idea how to deal with that? Thanks in advance!</p>