title: Why does the child class does not inherit the method from parent class in python in this example?
body: <p>I have the following code.</p>
  
  <pre><code>class Foo(object):
       def __init__(self):
           self.__baz = 40
       def foo(self):
           print self.__baz
  
  class Bar(Foo):
       def __init__(self):
           #super(Bar, self).__init__()
           self.__baz = 21
       def bar(self):
           print self.__baz
  
  x = Bar()
  x.foo()
  x.bar()
  </code></pre>
  
  <p>I get this error:</p>
  
  <pre><code>Traceback (most recent call last):
    File "classes.py", line 15, in &lt;module&gt;
      x.foo()
    File "classes.py", line 5, in foo
      print self.__baz
  AttributeError: 'Bar' object has no attribute '_Foo__baz'
  </code></pre>
  
  <p>why is the <code>foo</code> method not inherited in <code>Bar</code>.  </p>
  
  <p><strong>EDIT:</strong> It works fine, if you call super which is commented out.</p>