• Register
Welcome to Kodlogs, programming questions and answer website.
0 votes
47 views

Problem :

I am getting below error
maximum recursion depth exceeded while calling a python object

by (6.9k points)  

1 Answer

0 votes

Solution:

Python lacks the tail recursion optimizations which is common in functional languages like lisp. In Python, recursion is limited to 999 calls 

1) You can change the recursion limit with sys.setrecursionlimit(n) until the maximum allowed for your platform:

sys.setrecursionlimit(limit):

2) You can try to convert the algorithm from recursive to iterative. If recursion depth is bigger than allowed by your platform, it is the only way to fix the problem. 

Further Readings:

https://github.com/python/typing/issues/523

by (21.9k points)  
edited by
...