Tony @ Tue Dec 28, 2010 8:59 pm wrote:
I don't think Python implements tail-end call elimination; meaning you'd run out of stack space.
*sigh* too bad... Then executing the returned functions will probably be the easiest thing to do... Also, if you want the end return value to be something other than a function:
Python: |
def f1():
return lambda: f2(1)
def f2(a):
return a
def main():
func = f1
while func.__class__.__name__ == "function":
func = func()
|
Realized that it'll try to execute a value returned no matter what it is, changed so that it only executes functions...