| TypeCast/mishustina_margarita | TypeCast/Aleksyav | ||||
|---|---|---|---|---|---|
| f | 1 | from functools import wraps | f | 1 | from functools import wraps |
| 2 | 2 | ||||
| 3 | 3 | ||||
| n | 4 | def cast(type): | n | 4 | def cast(t): |
| 5 | def cast_wrapper(f): | 5 | def decorator(f): | ||
| 6 | @wraps(f) | 6 | @wraps(f) | ||
| t | 7 | def wrapper(*args, **kwargs): | t | 7 | def newfun(*args, **kwargs): |
| 8 | return type(f(*args, **kwargs)) | 8 | return t(f(*args, **kwargs)) | ||
| 9 | return wrapper | 9 | return newfun | ||
| 10 | return cast_wrapper | 10 | return decorator | ||
| 11 | 11 | ||||
| Legends | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|
|
| |||||||||