Slide 23
Slide 23 text
Descriptors
class ObjCInstance:
def __getattr__(self, name):
print("Getting attribute", name)
def __setattr__(self, name, value):
print("Set", name, "to", value)
>>> obj = ObjCInstance()
>>> obj.spam
Getting attribute spam
>>> obj.pork = "ham"
Set attribute pork to ham