JustCaptain kod-buduschego
53f23cfd3cd1680139f6a3e77997f1cb3a9b19b3
Перейти к файлу
Код
kod-buduschego Python 2025-20264.4. Декораторpracticesteachbasetask_2.py
anc update c70a58f 8 октября 2026 г.
task_2.py
from time import sleep, time
from typing import Any


def timer(func: Any) -> Any:

    def wrapper(*args, **kwargs) -> Any:
        start_time = time()
        result = func(*args, **kwargs)
        print("Время работы функции: {}".format(time() - start_time))
        return result

    return wrapper


@timer
def slow_function(time_stop: int) -> None:
    sleep(time_stop)


slow_function(time_stop=10)