Practice ยท 1 of 3
Who wins the lookup?
Implement a data descriptor Guarded that stores its value in the instance dict under the mangled name _value.
Also implement def probe(obj) that returns the string 'descriptor' if obj.value resolves through the descriptor's __get__ (i.e. the descriptor increments its own reads counter), or 'instance' otherwise.
The test will create an instance, set BOTH obj.value = 99 (a plain instance attribute attempt) and the descriptor state, and check that reading obj.value still goes through the descriptor.
Difficulty: advanced
Press Submit to check your solution.
Back to lesson: Practice: Attribute Lookup Practice