title: Usefulness of def __init__(self)?
body: <p>I am fairly new to python, and noticed these posts:
  <a href="https://stackoverflow.com/questions/625083/python-init-and-self-what-do-they-do">Python __init__ and self what do they do?</a> and 
  <a href="https://stackoverflow.com/questions/17331126/python-classes-without-using-def-init-self">Python Classes without using def __init__(self)</a></p>
  
  <p>After playing around with it, however, I noticed that these two classes give apparently equivalent results-</p>
  
  <pre><code>class A(object):
      def __init__(self):
          self.x = 'Hello'
  
      def method_a(self, foo):
          print self.x + ' ' + foo
  </code></pre>
  
  <p>(from <a href="https://stackoverflow.com/questions/625083/python-init-and-self-what-do-they-do">this question</a>) </p>
  
  <p>and </p>
  
  <pre><code>class B(object):
      x = 'Hello'
      def method_b(self,foo):
          print self.x + ' ' + foo
  </code></pre>
  
  <p>Is there any real difference between these two? Or, more generally, does <code>__init__</code> change anything inherently about the attributes of a class? In <a href="https://docs.python.org/2/reference/datamodel.html?highlight=__unicode__#object.__init__" rel="noreferrer">the documentation</a> it is mentioned that <code>__init__</code> is called when the instance is created. Does this mean that <code>x</code> in class <code>B</code> is established before instantiation? </p>