Have you ever wished to write a Python decorator with only one function instead of nested functions? If so, try decorator.
In the code above, time_func
and time_func_with_decorator
produce the exact same results except that time_func_with_decorator
is easier and short to write.