One of the 50 questions in this topic
How much do you know about Python?A decorator is a function that modifies the behavior of another function, method, or class without changing its internal code. They are applied using the @decorator_name syntax before definition. Decorators implement the Decorator design pattern and are useful for adding functionality such as logging, timing, access control, or caching to existing functions.