I have the following piece of code which fails with the following error:
RuntimeError: maximum recursion depth exceeded
I attemp
Besides optimizing tail recursion, you can set the recursion depth manually by:
import sys sys.setrecursionlimit(5500000) print("recursion limit:%d " % (sys.getrecursionlimit()))