A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2004-July/046224.html below:

[Python-Dev] Proper tail recursion

[Python-Dev] Proper tail recursion"Martin v. Löwis" martin at v.loewis.de
Thu Jul 15 21:08:24 CEST 2004
Michael Chermside wrote:
> No... that answer applies to *language features*, but not *implementation
> details*. The recursion limit (the value of it anyhow) is an
> implementation detail.

No, it is not. In standard Python, the program

def rec(n):
   rec(n-1)

n=1
while 1:
   try:
     rec(n)
   except RuntimeError:
     break
print "The recursion limit is", n

will terminate. In the modified Python, it will not terminate.
It is a change in behaviour, and thus a language feature.

> This doesn't bother me as much as it apparently bothers you. But for
> that matter, we hardly care about performance if we're going to be
> generating a stack trace, so we could probably construct the stack
> trace after-the-fact if needed.

No, you can't: You forgot already what all the local variables where.

Regards,
Martin

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4