Кравченко Роман, 420 FloatFix 14521
Данила Ковтун, 428 группа FloatFix 14162
f1from numbers import Realf1from numbers import Real
2from types import FunctionType2from types import FunctionType
33
4class fixed(type):4class fixed(type):
55
n6    def __new__(metaclass, name, parents, ns, ndigits=3):n6    def __new__(metacls, name, parents, ns, ndigits=3):
7        for (i, j) in ns.items():7        for (i, j) in ns.items():
8            if isinstance(j, FunctionType):8            if isinstance(j, FunctionType):
99
10                def new(*args, _fun=j, **kwargs):10                def new(*args, _fun=j, **kwargs):
n11                    res = _fun(*args, **kwargs)n11                    ans = _fun(*args, **kwargs)
12                    if isinstance(res, Real):12                    if isinstance(ans, Real):
13                        return round(res, ndigits)13                        return round(ans, ndigits)
14                    else:14                    else:
n15                        return resn15                        return ans
16                ns[i] = new16                ns[i] = new
t17        return super().__new__(metaclass, name, parents, ns)t17        return super().__new__(metacls, name, parents, ns)
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op