[ python-Feature Requests-1684603 ] Add tail recursion

SourceForge.net noreply at sourceforge.net
Tue Mar 20 18:59:36 CET 2007


Feature Requests item #1684603, was opened at 2007-03-20 18:59
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1684603&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: None
Group: None
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Tommy Nordgren (unclezeb)
Assigned to: Nobody/Anonymous (nobody)
Summary: Add tail recursion

Initial Comment:
Consider the following code:
def fac(m):
    def iter(acc,n):
        if n <= 0 :
            return acc
        else:
            return iter(acc * n, n - 1)
    return iter(1,m)

#When called wtih a large parameter, you get exceed the recursion limit

fac(10000)

In a future release, I suggest updating the interpreter and byte code compiler to handle tail recursion properly as in scheme.


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=355470&aid=1684603&group_id=5470


More information about the Python-bugs-list mailing list