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