Přečti kód pozorně
class DataDesc:
def __get__(self, instance, owner):
print("data:get")
return 1
def __set__(self, instance, value):
print(f"data:set:{value}")
class NonDataDesc:
def __get__(self, instance, owner):
print("nondata:get")
return 2
class Holder:
d = DataDesc()
n = NonDataDesc()
h = Holder()
h.__dict__["d"] = "shadow_d"
h.__dict__["n"] = "shadow_n"
print(h.d)
print(h.n)
Co program vypíše? Napiš sem: