TypeCast/argashok | TypeCast/aartur | ||||
---|---|---|---|---|---|
f | 1 | from functools import wraps | f | 1 | from functools import wraps |
2 | 2 | ||||
3 | 3 | ||||
4 | def cast(t): | 4 | def cast(t): | ||
5 | def decorator(f): | 5 | def decorator(f): | ||
6 | @wraps(f) | 6 | @wraps(f) | ||
n | 7 | def fun(*args): | n | 7 | def new_f(*args): |
8 | res = f(*args) | 8 | res = f(*args) | ||
9 | return t(res) | 9 | return t(res) | ||
t | 10 | return fun | t | 10 | return new_f |
11 | return decorator | 11 | return decorator | ||
12 | 12 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|