Skip to content

Instantly share code, notes, and snippets.

@mkelley33
Created March 23, 2011 23:16
Show Gist options
  • Save mkelley33/884240 to your computer and use it in GitHub Desktop.
Save mkelley33/884240 to your computer and use it in GitHub Desktop.
create a defaultdict whose values are also defaultdicts, nested arbitrarily deep
from:
http://personalpages.tds.net/~kent37/kk/00013.html
class recursivedefaultdict(defaultdict):
def __init__(self):
self.default_factory = type(self)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment