>>> NestedDD = lambda: collections.defaultdict(NestedDD) >>> nested_dd = NestedDD() >>> nested_dd['a']['b']['c']['d'] = 'hello'