Back to search

What is a decorator?

A decorator wraps another callable to add behavior without changing the original function body.

Python Easy Theory

What is a decorator?

A decorator wraps another callable to add behavior without changing the original function body.

  • Starts with a callable
  • Usually returns a wrapper
  • Common for logging, auth, caching

What is a decorator?