import time
import functools
def timer(func):
@functools.wraps(func)
def wrapper(*args, **kwargs):
start = time.perf_counter()
result = func(*args, **kwargs)
print(f"زمان اجرا: {time.perf_counter() - start:.4f} ثانیه")
return result
return wrapper
@timer
def heavy_task():
time.sleep(1)
heavy_task()
🐍 @python_rd
