Skip to content

Instantly share code, notes, and snippets.

View andrewpurcell's full-sized avatar

Andrew Purcell andrewpurcell

View GitHub Profile
@andrewpurcell
andrewpurcell / tree.md
Created April 24, 2012 00:12 — forked from hrldcpr/tree.md
one-line tree in python

One-line Tree in Python

Using Python's built-in defaultdict we can easily define a tree data structure:

def tree(): return defaultdict(tree)

That's it!