TypeCast/aartur
TypeCast/dakyun
f1from functools import wrapsf1from functools import wraps
22
33
n4def cast(t):n4def cast(type):
5    def decorator(f):5    def decor(f):
6        @wraps(f)6        @wraps(f)
n7        def new_f(*args):n7        def wrapper(*args):
8            res = f(*args)8            res = f(*args)
n9            return t(res)n9            return type(res)
10        return new_f
11    return decorator
1210
tt11        return wrapper
12 
13    return decor
14 
15 
16# @cast(int)
17# def fun(a, b):
18#     return a * 2 + b
19# print(fun(12, 34) * 2)
20# print(fun("12", "34") * 2)
21# print(fun(12.765, 34.654) * 2)
22 
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op