Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!
class _ExceptionHandlerBase: | |
def __init__(self, handler_map): | |
self._handler_map = handler_map | |
def __call__(self, func): | |
def wrapper(*args, **kwargs): | |
with self: | |
func(*args, **kwargs) | |
return wrapper |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)
That's it!