Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardPythondata model dunder dispatchSingle-choice MCQ

What does this print, and which class's __getattr__ versus __getattribute__ rule explains it?

class A: def __getattribute__(self, name): if name == 'x': raise AttributeError(name) return super().__getattribute__(name) def __getattr__(self, name): return f'fallback:{name}' a = A() print(a.x)