tail-recursion

Does Python optimize tail recursion?

Does Python optimize tail recursion? Question: I have the following piece of code which fails with the following error: RuntimeError: maximum recursion depth exceeded I attempted to rewrite this to allow for tail call optimization (TCO). I believe that this code would have been successful if a TCO had taken place. def trisum(n, csum): if …

Total answers: 8