title: Overriding __init__ with parent classmethod in python
body: <p>I want to do something like the following (in Python 3.7):</p>
  
  <pre><code>class Animal:
  
      def __init__(self, name, legs):
          self.legs = legs
          print(name)
  
      @classmethod 
      def with_two_legs(cls, name):
          # extremely long code to generate name_full from name
          name_full = name
          return cls(name_full, 2)
  
  class Human(Animal):
  
      def __init__(self):
          super().with_two_legs('Human')
  
  john = Human()
  </code></pre>
  
  <p>Basically, I want to override the <code>__init__</code> method of a child class with a factory classmethod of the parent. The code as written, however, does not work, and raises:</p>
  
  <pre><code>TypeError: __init__() takes 1 positional argument but 3 were given
  </code></pre>
  
  <p>I think this means that <code>super().with_two_legs('Human')</code> passes <code>Human</code> as the <code>cls</code> variable.</p>
  
  <p>1) Why doesn't this work as written? I assumed <code>super()</code> would return a proxy instance of the superclass, so <code>cls</code> would be <code>Animal</code> right?</p>
  
  <p>2) Even if this was the case I don't think this code achieves what I want, since the classmethod returns an instance of <code>Animal</code>, but I just want to initialize <code>Human</code> in the same way classmethod does, is there any way to achieve the behaviour I want?</p>
  
  <p>I hope this is not a very obvious question, I found the <a href="https://docs.python.org/3/library/functions.html#super" rel="nofollow noreferrer">documentation</a> on <code>super()</code> somewhat confusing.</p>