It's not Python.  It's pseudocode (based on Lisp, but with Scheme naming conventions) that just happens to look like Python.  So there.  :P


(My original code is in Common Lisp, and has some memoization going on, too, so I figured I'd render it in a way that's more readable to people who might not necessarily know Common Lisp.  I really did think, "Well, I'll make it pseudocode.  Hey, everyone's always saying how Python looks like pseudocode; I'll make pseudocode that looks like Python.")