Skip to content

Latest commit

 

History

History
 
 

18 - Decorators

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 

Decorators

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')