f | def fix(n): | f | def fix(n): |
| | | |
n | def fun_dec(f): | n | def dec(fun): |
| | | |
t | def fun_args(*args, **kwargs): | t | def wrapper(*args, **kwargs): |
| new_args = [round(arg, n) if type(arg) == float else arg for arg in args] | | args = [round(x, n) if type(x) == float else x for x in args] |
| new_kwargs = {key: round(val, n) if type(val) == float else val for (key, val) in kwargs.items()} | | kwargs = {key: round(x, n) if type(x) == float else x for (key, x) in kwargs.items()} |
| new_f = f(*new_args, **new_kwargs) | | result = fun(*args, **kwargs) |
| return round(new_f, n) if type(new_f) == float else new_f | | return round(result, n) if type(result) == float else result |
| return fun_args | | return wrapper |
| return fun_dec | | return dec |