TypeCast/Cactiw | TypeCast/s02210256 | ||||
---|---|---|---|---|---|
t | 1 | import functools | t | 1 | import functools |
2 | 2 | ||||
3 | 3 | ||||
4 | def cast(cast_type): | 4 | def cast(cast_type): | ||
5 | def decorator(func): | 5 | def decorator(func): | ||
6 | @functools.wraps(func) | 6 | @functools.wraps(func) | ||
7 | def wrapper(*args, **kwargs): | 7 | def wrapper(*args, **kwargs): | ||
8 | return cast_type(func(*args, **kwargs)) | 8 | return cast_type(func(*args, **kwargs)) | ||
9 | return wrapper | 9 | return wrapper | ||
10 | return decorator | 10 | return decorator | ||
11 | 11 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|