Пак Алиса, 611 группа ExceptionTree 11953
Воробьев Егор Александрович, 419/2 (КФ) ExceptionTree 11677
f1class ExceptionTree:f1class ExceptionTree:
22
3    def __init__(self):3    def __init__(self):
n4        self.exceptions = {}n4        self._exceptions = {}
55
n6    def __call__(self, n):n6    def __call__(self, index):
7        if in self.exceptions:7        if index in self._exceptions:
8            return self.exceptions[n]8            return self._exceptions[index]
9        if index == 1:
10            base_exception = Exception
9        else:11        else:
t10            if n == 1:t
11                base = Exception
12            else:
13                base = self(n // 2)12            base_exception = self(index // 2)
14            ExceptionN = type(f'Exception{n}', (base,), {'n': n})13        new_exception = type(f'Exception-{index}', (base_exception,), {'
 >n': index})
15            self.exceptions[n] = ExceptionN14        self._exceptions[index] = new_exception
16            return ExceptionN15        return new_exception
Legends
Colors
 Added 
Changed
Deleted
Links
(f)irst change
(n)ext change
(t)op