Given:
In [37]: class A:
....: f = 1
....:
In [38]: class B(A):
....: pass
....:
In [39]: getattr(B, 'f')
Out[39]: 1
Okay, that either calls super or crawls the mro?
In [40]: getattr(A, 'f')
Out[40]: 1
This is expected.
In [41]: object.__getattribute__(A, 'f')
Out[41]: 1
In [42]: object.__getattribute__(B, 'f')
---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
<ipython-input-42-de76df798d1d> in <module>()
----> 1 object.__getattribute__(B, 'f')
AttributeError: 'type' object has no attribute 'f'
What is getattribute not doing that getattr does?
In [43]: type.__getattribute__(B, 'f')
Out[43]: 1
What?! type.__getattribute__
calls super but object
's version doesn't?
In [44]: type.__getattribute__(A, 'f')
Out[44]: 1