Decorator in Python

Decorator in Python

If you want to apply a common piece of functionality to multiple functions while keeping the code clean, use a decorator. Decorator modifies the behavior of your Python functions without altering the code directly.

In the code above, time_func is a decorator that can be used to track the execution time of any function.

Scroll to Top

Work with Khuyen Tran

Work with Khuyen Tran