Oleg_Py Asked:2024-04-07 20:41:11 +0000 UTC2024-04-07 20:41:11 +0000 UTC 2024-04-07 20:41:11 +0000 UTC Python 装饰器。调用函数时的应用 772 是否可以在调用函数时而不是定义函数时应用装饰器? python 1 个回答 Voted Best Answer Mipsirint 2024-04-07T21:19:23Z2024-04-07T21:19:23Z 是的,也是选项之一: def decorator(function): def wrapper(*args): print("Это начало декоратора") print(function(*args)) print("А это конец декоратора") return wrapper def func(x): return x * 2 decorated_func = decorator(func) decorated_func(10)
是的,也是选项之一: