I would like to understand how the built-in function property
works. What confuses me is that property
can also be used as a decorator, but it only
This point is been cleared by many people up there but here is a direct point which I was searching. This is what I feel is important to start with the @property decorator. eg:-
class UtilityMixin():
@property
def get_config(self):
return "This is property"
The calling of function "get_config()" will work like this.
util = UtilityMixin()
print(util.get_config)
If you notice I have not used "()" brackets for calling the function. This is the basic thing which I was searching for the @property decorator. So that you can use your function just like a variable.