title: Why do we use __init__ in Python classes?
body: <p>I am having trouble understanding the Initialization of classes.</p>
  
  <p>What's the point of them and how do we know what to include in them? Does writing in classes require a different type of thinking versus creating functions (I figured I could just create functions and then just wrap them in a class so I can re-use them. Will that work?)</p>
  
  <p>Here's an example:</p>
  
  <pre><code>class crawler:
    # Initialize the crawler with the name of database
    def __init__(self,dbname):
      self.con=sqlite.connect(dbname)
  
    def __del__(self):
      self.con.close()
  
    def dbcommit(self):
      self.con.commit()
  </code></pre>
  
  <p>Or another code sample:</p>
  
  <pre><code>class bicluster:
    def __init__(self,vec,left=None,right=None,distance=0.0,id=None):
      self.left=left
      self.right=right
      self.vec=vec
      self.id=id
      self.distance=distance
  </code></pre>
  
  <p>There are so many classes with <code>__init__</code> I come across when trying to read other people's code, but I don't understand the logic in creating them.</p>