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 |
| Largest 1000 Cities in America | |
| 2013 popuation data - Biggest US Cities By Population | |
| rank,city,state,population,2000-2013 growth | |
| 1,New York,New York,8405837,4.8% | |
| 2,Los Angeles,California,3884307,4.8% | |
| 3,Chicago,Illinois,2718782,-6.1% | |
| 4,Houston,Texas,2195914,11.0% | |
| 5,Philadelphia,Pennsylvania,1553165,2.6% |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!