title: Should all member variables be initialized in __init__
body: <p>Maybe this is more of a style question than a technical one but I have a class with several member variables and I want to have it work so that some of the member variables are initialized when the user first creates an instance of the class (i.e. in the <code>__init__</code> function) and I want the other member variables to be defined from arguments of member functions that will be called later on.  So my question is should I initialize all member variables in the <code>__init__</code> function (and set the ones that will be defined later on to dummy values) or initialize some in the <code>__init__</code> function and some in later functions.  I realize this might be difficult to understand so here are a couple of examples.</p>
  
  <p>This example has <code>var3</code> set to 0 initially in the <code>__init__</code> function, then set to the desired value later on in the my_funct function.</p>
  
  <pre><code>class myClass(object):
     def __init__(self,var1,var2):
          self.var1=var1
          self.var2=var2
          self.var3=0
  
    def my_funct(self,var3):
         self.var3=var3
  </code></pre>
  
  <p>and in this example, <code>var3</code> is not defined at all in the <code>__init__</code> function </p>
  
  <pre><code>class myClass(object):
     def __init__(self,var1,var2):
          self.var1=var1
          self.var2=var2
  
    def my_funct(self,var3):
         self.var3=var3
  </code></pre>
  
  <p>I don't think either way would make a big difference (maybe a slight difference in memory usage).  But I was wondering if one of these is preferred over the other for some reason.</p>