Concrete Proposal: while ... and while ...

Terry Reedy tjreedy at udel.edu
Sat May 22 00:25:18 EDT 1999


[posted and emailed]

>Huh?  Scheme is explicitly tail-recursive by definition, and I don't know of
>any way that python is "more dynamic" than scheme.  I don't think dynamism 
is
>the issue.  What did you have in mind?

Guido recently explained that the interpreter cannot assume that the inner 
call to a recursive function actually calls the function within which it 
sits.  Untested example:

def recur(n):
  global recur
  if strange(n): recur = recur2
  if n == 0: return term(n)
  else:      return recur(n-1)

looks tail recursive but is not.  The redefinition of recur could be less 
obvious.

Terry J. Reedy





More information about the Python-list mailing list