p
y
c
h
a
l
l
e
n
g
e
r
Home
Intermediate Python
Decorators
Decorators
decorators
@ syntax
wrapper function
higher-order functions
functools.wraps
decorator factory
stacking decorators
NEXT
Introduction to decorators
LESSON
Exercise: Write a simple decorator
CHALLENGE
Exercise: Apply a decorator with @
CHALLENGE
Exercise: Decorator that prints around the call
CHALLENGE
Exercise: Decorator that doubles the result
CHALLENGE
Wrapping any function: *args, **kwargs and functools.wraps
LESSON
Exercise: Forward *args and **kwargs
CHALLENGE
Exercise: Preserve the function name with functools.wraps
CHALLENGE
Exercise: Decorator that records every call
CHALLENGE
Decorator factories and stacking decorators
LESSON
Exercise: Decorator with a parameter
CHALLENGE
Exercise: Stack two decorators
CHALLENGE