Skip to content
dreamcode
dreamcode
Back to map
Decorators · Lesson 31 of 44
+15 XP on finish
PYTHON ADVANCED

Custom decorators

A decorator wraps another function to modify its behavior without changing its code. They are denoted with @decorator_name.

How it reads
def wrapper(text) defines the inner wrapping function that runs
@yell wraps the greet function inside yell
Cloud tip: Decorators are functions that take another function as an argument and return a new function.
main.py
PYTHON
real Python, runs in your browser
CONSOLE
- run your code to see output -