When CPython evaluates the implicit iter(c) below, the __getattribute__ override does NOT print for the __iter__ lookup, but the explicit attribute access does. What mechanism explains this?
class C:
def __getattribute__(self, name):
print('getattribute:', name)
return object.__getattribute__(self, name)
def __iter__(self):
return iter([1, 2, 3])
c = C()
c.__iter__ # prints 'getattribute: __iter__'
list(iter(c)) # does NOT print for __iter__