Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| #!/usr/bin/python | |
| # -*- coding: utf-8 -*- | |
| import subprocess | |
| __all__ = ["transform"] | |
| __version__ = '0.3' | |
| __author__ = 'Christoph Burgmer <[email protected]>' | |
| __url__ = 'http://github.com/cburgmer/upsidedown' |
| javascript:(function(){var a,b;a=function(a){return function(){return!!~(this.alt||this.title).indexOf(a)}}($(".member-avatar").attr("title").match(/\(([\w\-]+)\)$/)[1]),b=function(){var b;return!(b=$(this).find(".member img,.member-initials")).length||b.filter(a).length},$("#board").addClass("filtering").find(".list-card").addClass("hide").filter(b).removeClass("hide")})() |
| ## | |
| ## Milk from Milk and Cheese | |
| ## | |
| $the_cow = <<EOC; | |
| $thoughts ___ | |
| $thoughts / \\ | |
| $thoughts / \\ | |
| / \\ | |
| ___ ___ | |
| /___\\ /___\\ |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!