I have biuld a function in python that replicates a circuit of three other functions (defined in the main function) that call eachother while iterating over a given list of numbers required in the main function (In the code there is a way to break out of the recursion circuit). Basically this structure:
def main_function(list_of_numbers, parameter_1, parameter_2):
def block1():
nonlocal result_1, result_2, var_1, var_2, var_3
# Code
block2()
def block2():
nonlocal result_1, result_2, var_1, var_2, var_3
# Code
if b:
# Code
block2()
else:
# Code
block3()
def block3():
nonlocal result_1, result_2, var_1, var_2, var_3
# Code
if a:
# Code
bloc1()
else:
# Code
if b:
# Code
if b:
# Code
if c:
# Code
block1()
else:
block2()
else:
block2()
else:
block3()
result_1 = []
result_2 = []
var_1 = 0
var_2 = 0
var_3 = 0
block1()
return result_1, result_2
The problem I'm having is that if the list of numbers is larger than 500 values then this error appears:
RecursionError: maximum recursion depth exceeded in comparison
I know I can change the limit of recursion but what does that mean, is my computer gonna be affected if I want to operate a list of half a million values?. The code inside the functions is quite simple and short.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…