Decorators are similar to attributes in that they add meaning or functionality to blocks of code in Python. They're frequently used in frameworks such as Flask or Django. The most common interaction you'll have with decorators as a Python developer is through using them rather than creating them.
# Example decorator
@log(True)
def sample_function():
print('this is a sample function')