Next: 5.6 Local Call
Up: 5.5 Tail Recursion
Previous: 5.5 Tail Recursion
Although Python is claimed to be ``properly'' tail-recursive, some
might dispute this, since there are situations where tail recursion is
inhibited:
- When the call is enclosed by a special binding, or
- When the call is enclosed by a catch or
unwind-protect, or
- When the call is enclosed by a block or tagbody
and the block name or go tag has been closed over.
These dynamic extent binding forms inhibit tail recursion because they
allocate stack space to represent the binding. Shallow-binding
implementations of dynamic scoping also require cleanup code to be
evaluated when the scope is exited.
Raymond Toy
Mon Jul 14 09:11:27 EDT 1997