title: Python 3 __getattribute__ vs dot access behaviour
body: <p>I read a bit on python's  object attribute lookup (here: <a href="https://blog.ionelmc.ro/2015/02/09/understanding-python-metaclasses/#object-attribute-lookup" rel="nofollow noreferrer">https://blog.ionelmc.ro/2015/02/09/understanding-python-metaclasses/#object-attribute-lookup</a>).</p>
  <p>Seems pretty straight forward, so I tried it out (python3):</p>
  <pre class="lang-py prettyprint-override"><code>class A:
      def __getattr__(self, attr):
          return (1,2,3)
  
  a = A()
  
  a.foobar #returns (1,2,3) as expected
  a.__getattribute__('foobar') # raises AttributeError
  </code></pre>
  <p>My question is, aren't the two supposed to be identical?</p>
  <p>Why does the second one raise an attribute error?</p>
  <p>So apparently the answer is that the logic for <code>a.foobar</code> IS different from the logic for <code>a.__getattribute(&quot;foobar&quot;)</code>. According to the <a href="https://docs.python.org/3.5/reference/datamodel.html#object.__getattribute__" rel="nofollow noreferrer">data model</a>: <code>a.foobar</code> calls <code>a.__getattribute(&quot;foobar&quot;)</code> and if it raises an AttributeError, it calls <code>a.-__getattr__('foobar')</code></p>
  <p>So it seems the article has a mistake in their diagram. Is this correct?</p>
  <p>And another question: Where does the real logic for <code>a.foobar</code> sit? I thought it was in <code>__getattribute__</code> but apparently not entirely.</p>
  <p>Edit:
  <strong>Not a duplicate of</strong></p>
  <p><a href="https://stackoverflow.com/questions/3278077/difference-between-getattr-vs-getattribute">Difference between __getattr__ vs __getattribute__</a>.
  I am asking here what is the different between <code>object.foo</code> and <code>object.__getattribute__(&quot;foo&quot;)</code>. This is different from <code>__getattr__</code> vs <code>__getatribute__</code> which is trivial...</p>