Home / Pre-Commit hooks / Chapter 1

Chapter 1: Introduction

Dec 14, 2024
1 of 7

So, what exactly is a decorator? A decorator is a function that takes another function (the decorated function) as an argument and returns a new function. This new function usually extends or modifies the behavior of the original function. Decorators allow you to add functionality to functions or classes in a clean and reusable way without directly altering their source code. They essentially “wrap” the original function, adding extra behavior before or after its execution.