Source code for data_structures.trees.simple_tree
# -*- coding: utf-8 -*-
"""Simple tree data structure backed by a nested dictionary."""
from typing import Dict
[docs]
class Tree(Dict):
""" Basic implementation based on Dictionary """
def __missing__(self, key):
value = self[key] = type(self)()
return value