Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| #!/usr/bin/env bash | |
| set -o errexit -o nounset -o pipefail | |
| cd "$(mktemp --directory)" | |
| git init | |
| cat > test.txt <<EOF | |
| alfa | |
| bravo | |
| charlie |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| #!/usr/bin/env python | |
| # gtk-theme-swatch: A PyGtk widget that displays the color swatches of all | |
| # gtk.Styles, in all states. Useful for designing themes | |
| # author: John Stowers <john.stowers@gmail.com> | |
| import gtk | |
| class ThemeSwatch(gtk.DrawingArea): | |
| SWATCH_SIZE = 50 #swatch size |