Назаренко Глеб 622 группа CorrectFloat 14319
Аксенов Павел Николаевич 530 CorrectFloat 14601
f1from functools import wrapsf1from functools import wraps
22
3class Fix:3class Fix:
44
5    def __init__(self, n):5    def __init__(self, n):
6        self.n = n6        self.n = n
77
8    def __call__(self, func):8    def __call__(self, func):
99
10        @wraps(func)10        @wraps(func)
n11        def wrapped(*args, **kwargs):n11        def wrapper(*args, **kwargs):
12            args = tuple((round(arg, self.n) if isinstance(arg, float) e12            rounded_args = tuple((round(arg, self.n) if isinstance(arg, 
>lse arg for arg in args))>float) else arg for arg in args))
13            kwargs = {key: round(value, self.n) if isinstance(value, flo13            rounded_kwargs = {k: round(v, self.n) if isinstance(v, float
>at) else value for key, value in kwargs.items()}>) else v for k, v in kwargs.items()}
14            result = func(*args, **kwargs)14            result = func(*rounded_args, **rounded_kwargs)
15            return round(result, self.n) if isinstance(result, float) el15            return round(result, self.n) if isinstance(result, float) el
>se result>se result
t16        return wrappedt16        return wrapper
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op