The basic way of creating decorators is
def my_decorator(f):
def _f(*args, **kwargs):
# do something using f
pass
return _f
@my_decorator
def f(...):
...
But that way you cannot define decorators like @property.setter
, because the name of the property (and thus the name of the decorator) is different every time.
How is it @property.setter
defined then? Is it possible to do something similar in Python, or is it built-in feature available only from C (implementation) level?