TypeCast/andreiduginpython21 | TypeCast/alex.ust98 | ||||
---|---|---|---|---|---|
f | 1 | from functools import wraps | f | 1 | from functools import wraps |
2 | 2 | ||||
3 | 3 | ||||
t | 4 | def cast(type): | t | 4 | def cast(f): |
5 | @wraps(type) | 5 | @wraps(f) | ||
6 | def decorator(a): | 6 | def wrapper(func): | ||
7 | @wraps(a) | 7 | @wraps(func) | ||
8 | def myfun(*args): | 8 | def _w(*args): | ||
9 | return type(a(*args)) | 9 | return f(func(*args)) | ||
10 | return myfun | 10 | return _w | ||
11 | return decorator | 11 | return wrapper | ||
12 | 12 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|