Skip to main content
Journey Uncommon Logo
JourneyUncommon
hardPythondescriptorsSingle-choice MCQ

A function defined on a class is shadowed by an instance-dict entry of the same name. What does c.f() return, and what descriptor classification explains it?

class C: def f(self): return 'method' c = C() c.__dict__['f'] = lambda: 'shadowed' print(c.f())