TypeCast/VladislavKotX
TypeCast/Anya2699
f1from functools import wrapsf1from functools import wraps
22
33
n4def cast(type):n4def cast(tp):
5    def decorator(f):5    def decor(fun):
6        @wraps(f)6        @wraps(fun)
7        def fun(*args):7        def nfun(*a):
8            return type(f(*args))8            return tp(fun(*a))
9        return fun9        return nfun
10    return decorator10    return decor
1111
tt12##
13# @cast(int)
14# def fun(a, b):
15# return a * 2 + b
16##
17##print(fun(12, 34) * 2)
18##print(fun("12", "34") * 2)
19##print(fun(12.765, 34.654) * 2)
20##
21# @cast(list)
22# def fun(a, b):
23# return a * 2 + b
24##print(*fun("QW", "er"))
25##print(*fun(sorted("WDC"), sorted("rfv")))
26# print(fun.__name__)
27 
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op