Skip to content

Instantly share code, notes, and snippets.

@lextoumbourou
Created December 7, 2014 02:31
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 lextoumbourou/bba467e3e52284d8e7a2 to your computer and use it in GitHub Desktop.
Save lextoumbourou/bba467e3e52284d8e7a2 to your computer and use it in GitHub Desktop.
Super simple auto nested dict in Python
from collections import defaultdict
def auto_nested_dict():
return defaultdict(auto_nested_dict)
if __name __ == '__main__':
d = auto_nested_dict()
d['wats']['up']['world'] = 'Here I am!'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment