What is the difference between using the @property decorator as a "getter" and just defining the variable normally?
See an example below:
Class MyClass(object):
def __init__(self, ....):
....
@property
def headers(self):
return {"Content-Type": "application/json"}
Versus:
Class MyClass(object):
def __init__(self, ....):
.....
self.headers = {"Content-Type": "application/json"}
Why use one over the other? When should the property decorator be used?