Maximum recursion depth in python

Michael Hudson mwh21 at cam.ac.uk
Sat Nov 4 13:57:58 EST 2000


D-Man <dsh8290 at rit.edu> writes:

> On Thu, 02 Nov 2000 12:48:50 Aahz Maruch wrote:
>  | Note, too, that I believe
>  | that one of the goals for Stackless is to eventually create a
>  | tail-recursion module, 
> 
> Awesome!  Tail-recursion is one of the really cool things Lisp has
> that I haven't seen anywhere alse yet.

1) ITYM "scheme" not "Lisp" - not all Lisps require the tail call
   optimization (eg. Common Lisp) .

2) Implementing something tail recursively in Python is liekly to
   lose, as the function call is a pretty expensive operation.  If it
   can be written as a loop, write it as a loop!  If you can't write
   it as a loop, then you'll have trouble writing it tail recursively.

python-is-not-a-functional-programming-language-ly y'rs
M.

-- 
  The ability to quote is a serviceable substitute for wit.
                                                -- W. Somerset Maugham



More information about the Python-list mailing list