I was reading this post and few things don't get cleared
https://stackoverflow.com/a/14787522/1890488
He uses this code
class O4(O3):
@property # this decorator makes this instancevar into a data descriptor
def var(self):
return "Data descriptors (such as properties) are high priority"
@var.setter # I'll let O3's constructor set a value in __dict__
def var(self, value):
self.__dict__["var"] = value # but I know it will be ignored
He says that @property converts any instance variable into data descriptor.
- Now does it mean that it automatically defines
__get__
,__set__
and__del__
for that varaible
or @property is only equivalent to __get__
i am not getting it
Are there any more decorators which convert instance variables to data descriptors
what is the function of @var.setter. is that also the data descriptor part