Skip to content

Instantly share code, notes, and snippets.

View hbast's full-sized avatar
🏠
Working from home

Holger hbast

🏠
Working from home
View GitHub Profile
@hrldcpr
hrldcpr / tree.md
Last active January 7, 2026 08:16
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!