f | def fix(n): | f | def fix(n): |
| | | |
| def dec(fun): | | def dec(fun): |
| | | |
n | def newfun(*args, **kwargs): | n | 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 = {name: round(val, n) if type(val) == float else val for (name, val) in kwargs.items()} | | kwargs = {key: round(x, n) if type(x) == float else x for (key, x) in kwargs.items()} |
| result = fun(*new_args, **new_kwargs) | | result = fun(*args, **kwargs) |
| return round(result, n) if type(result) == float else result | | return round(result, n) if type(result) == float else result |
t | return newfun | t | return wrapper |
| return dec | | return dec |