Python Tutorial #14: Decorators — Functions That Modify Functions

In the previous tutorial, we learned about generators and iterators. Now let’s learn about decorators — a powerful pattern that lets you modify functions without changing their code. Decorators are one of Python’s most distinctive features. They are used everywhere: web frameworks (Flask, FastAPI), testing (pytest), caching, authentication, and validation. By the end of this tutorial, you will know how to create your own decorators and understand the ones you encounter in libraries. ...

April 28, 2026 · 9 min