TypeCast/dfrant | TypeCast/JuliaZ | ||||
---|---|---|---|---|---|
f | 1 | from functools import wraps | f | 1 | from functools import wraps |
2 | 2 | ||||
3 | 3 | ||||
n | 4 | def cast(func_type): | n | 4 | def cast(type): |
5 | def decorator(func): | 5 | def functional(func): | ||
6 | @wraps(func) | 6 | @wraps(func) | ||
n | 7 | def new_func(*args): | n | 7 | def argument(*args): |
8 | return func_type(func(*args)) | 8 | return type(func(*args)) | ||
9 | return new_func | ||||
10 | return decorator | ||||
11 | 9 | ||||
t | t | 10 | return argument | ||
11 | |||||
12 | return functional | ||||
13 |
Legends | ||||||||||
---|---|---|---|---|---|---|---|---|---|---|
|
|