This question is about implementing the full Perl autovivification in Python. I know similar questions were asked before and so far the best answer is in \"What is the best
a = collections.defaultdict(lambda: collections.defaultdict(list))