f | class ExceptionTree: | f | class ExceptionTree: |
| | | |
| def __init__(self): | | def __init__(self): |
n | self.classes = {1: type('Exception1', (Exception,), {'n': 1})} | n | self.classes = {1: type('Exception-1', (Exception,), {'n': 1})} |
| | | |
| def __call__(self, n): | | def __call__(self, n): |
| if n not in self.classes: | | if n not in self.classes: |
| parent_class = self(n // 2) | | parent_class = self(n // 2) |
t | self.classes[n] = type(f'Exception{n}', (parent_class,), {'n | t | self.classes[n] = type(f'Exception-{n}', (parent_class,), {' |
| ': n}) | | n': n}) |
| return self.classes[n] | | return self.classes[n] |