Skip to content

Instantly share code, notes, and snippets.

@yhchan
Created April 18, 2013 07:45
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save yhchan/5410941 to your computer and use it in GitHub Desktop.
Save yhchan/5410941 to your computer and use it in GitHub Desktop.
python defaultdict
from collections import defaultdict
class _MissingDictionary(defaultdict):
def __missing__(self, key):
return defaultdict(_MissingDictionary)
configs = defaultdict(_MissingDictionary)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment