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

Consider attribute lookup `instance.x` where `type(instance)` defines `x` as a data descriptor and the instance `__dict__` also has a key `'x'`. Which wins, and why, in terms of `type.__getattribute__`'s algorithm?

class D: def __get__(self, o, t): return 'descriptor' def __set__(self, o, v): pass class C: x = D() c = C() c.__dict__['x'] = 'instance' print(c.x)