pychallenger

pychallenger

  • Dashboard
  • Python Basics
  • Intermediate Python
  • Basic Data Analysis
  • Login
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
Links
Blog Pricing Sign Up
Social
Twitter YouTube LinkedIn
Imprint Privacy Policy Terms
Copyright © 2026 Erik Nogueira Kückelheim