f | from functools import wraps | f | from functools import wraps |
| | | |
| | | |
n | def cast(tp): | n | def cast(arg): |
| def decor(fun): | | def one(arg2): |
| @wraps(fun) | | @wraps(arg2) |
| def nfun(*a): | | def fun(*args): |
| return tp(fun(*a)) | | return arg(arg2(*args)) |
| return nfun | | return fun |
| return decor | | return one |
| | | |
t | ## | t | |
| # @cast(int) | | |
| # def fun(a, b): | | |
| # return a * 2 + b | | |
| ## | | |
| ##print(fun(12, 34) * 2) | | |
| ##print(fun("12", "34") * 2) | | |
| ##print(fun(12.765, 34.654) * 2) | | |
| ## | | |
| # @cast(list) | | |
| # def fun(a, b): | | |
| # return a * 2 + b | | |
| ##print(*fun("QW", "er")) | | |
| ##print(*fun(sorted("WDC"), sorted("rfv"))) | | |
| # print(fun.__name__) | | |
| | | |