Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!
| // Use Gists to store code you would like to remember later on | |
| console.log(window); // log the "window" object to the console |
| ;; original @link https://gist.github.com/codification/1984857 | |
| (ns proc | |
| (:import [java.lang ProcessBuilder]) | |
| (:use [clojure.java.io :only [reader writer]])) | |
| (defn spawn [& args] | |
| (let [process (-> (ProcessBuilder. args) | |
| (.start))] | |
| {:out (-> process |
| ## original is on https://gist.github.com/reedobrien/701444 | |
| ## it's newer version (works on python 3) | |
| ## code may contain bugs, check carefully | |
| import deform | |
| import deform.widget | |
| from deform.widget import CheckedInputWidget | |
| from colander import null, Invalid | |
| from pyramid.threadlocal import get_current_request |
Using Python's built-in defaultdict we can easily define a tree data structure:
def tree(): return defaultdict(tree)That's it!