title: Very strange __getattr__ behavior in python
body: <p>I had an error in my code (similar to the error below) but the result seems very strange to me. Can someone explain to me how <strong>getattr</strong> is getting called with the name being "hello"?</p>
  
  <pre><code>class A(object):
      def __getattr__(self, name):
          print name
          assert name != 'hello'
          return self.hello
  
  class C(object):
      def __init__(self):
          class B(A):
              @property
              def hello(self_):
                  return self.durp
  
          self.b = B()
  
  c = C()
  print c.b.bang
  </code></pre>
  
  <p>The output of this is:</p>
  
  <pre><code>bang
  hello
  Traceback (most recent call last):
    File "test.py", line 17, in &lt;module&gt;
      print c.b.bang
    File "test.py", line 5, in __getattr__
      return self.hello
    File "test.py", line 4, in __getattr__
      assert name != 'hello'
  AssertionError
  
  shell returned 1
  </code></pre>
  
  <p>I understand of course that there is no durp property in C (this is the error I speak of). However, I would not expect <code>__getattr__</code> to be called with hello as the string. I feel like I'm not understanding something fundamental about the way <code>__getattr__</code> works.</p>