title: How to call parent class init with default values from child class?
body: <p>I am trying to give my subclasses default variables and stop duplicating code as the file is getting fat:</p>
  
  <pre><code>class Base(object):
  
      def __init__(self, username=None, password=None, start_url=None):
          self.username  = username
          self.password  = password
          self.start_url = start_url
  
  class Subclass(Base):
  
      def __init__(self, username="hoss_it87", password="whatsgoodSO", start_url="www.boss-sauce.com"):
          super(Subclass, self).__init__()
  </code></pre>
  
  <p><code>Base</code> works of course, but I want <code>Subclass</code> to init the same way, just overriding the <code>None</code> with real strings (all login styles are similar of course).</p>
  
  <pre><code>In [12]: x = Base('myuser', 'mypassword', 'www.google.com')
  
  In [13]: x.username
  Out[13]: 'myuser'
  
  In [14]: x.start_url
  Out[14]: 'www.google.com'
  
  In [15]: y = Subclass()
  
  In [16]: y.username
  
  In [17]: y.start_url
  
  In [18]: y.password
  
  In [19]: 
  </code></pre>
  
  <p>Why do I get nothing for <code>Subclass</code> attributes, and how can I fix it? Thank you</p>
  
  <p>Please note removing base class defaults causes other issues</p>
  
  <pre><code>class Base(object):
  
      def __init__(self, username, password, start_url):
          self.username  = username
          self.password  = password
          self.start_url = start_url
  
  class Subclass(Base):
  
      def __init__(self, username="honeybooboosbiggestfan", password="toomuchburkerking", start_url="www.imjokingiprefericeroadtruckers.com"):
          super(Subclass, self).__init__()
  
  
  In [24]: y = Subclass()
  ---------------------------------------------------------------------------
  TypeError                                 Traceback (most recent call last)
  &lt;ipython-input-24-55b9b4fdf93b&gt; in &lt;module&gt;()
  ----&gt; 1 y = Subclass()
  
  &lt;ipython-input-23-a9dc62450db7&gt; in __init__(self, username, password, start_url)
        9 
       10     def __init__(self, username="honeybooboosbiggestfan", password="toomuchburkerking", start_url="www.imjokingiprefericeroadtruckers.com"):
  ---&gt; 11         super(Subclass, self).__init__()
  
  TypeError: __init__() takes exactly 4 arguments (1 given)
  
  In [25]: 
  </code></pre>
  
  <p>Solved:</p>
  
  <pre><code>class Base(object):
  
      def __init__(self, username, password, start_url):
          self.username  = username
          self.password  = password
          self.start_url = start_url
  
  class Subclass(Base):
  
      def __init__(self, username="honeybooboosbiggestfan", password="toomuchburkerking", start_url="www.imjokingiprefericeroadtruckers.com"):
          super(Subclass, self).__init__(username=username, password=password, start_url=start_url)
  
  ## -- End pasted text --
  
  In [26]: y = Subclass()
  
  In [27]: y.username
  Out[27]: 'honeybooboosbiggestfan'
  
  In [28]: 
  </code></pre>