TypeCast/Ushuaya
TypeCast/meowr
f1from functools import wrapsf1from functools import wraps
22
33
n4def cast(tyte):n4def cast(t):
5    def _repeat(f):5    def decorator(f):
6        @wraps(f)6        @wraps(f)
n7        def inner(*args, **kwargs):n7        def new_f(*args):
8            try:8            try:
n9                return tyte(f(*args))n9                return t(f(*args))
10            except BaseException:10            except BaseException:
11                return f(*args)11                return f(*args)
n12        return innern12        return new_f
13    return _repeat13    return decorator
1414
t15# @cast(int)t
16# def fun(a, b):
17#     return a * 2 + b
18# print(fun(12, 34) * 2)
19# print(fun("12", "34") * 2)
20# print(fun(12.765, 34.654) * 2)
21 
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op