Python 中递归的最大次数
可以使用sys.setrecursionlimit来调整
#windows10
count=10000
temp=[]
def fun():
# print(count)
temp.append(1)
if count>0:
fun()
fun()
print(len(temp))
#2966
#RecursionError: maximum recursion depth exceeded in comparison
import sys
sys.setrecursionlimit(100)
count=10000
temp=[]
def fun():
# print(count)
temp.append(1)
if count>0:
fun()
fun()
print(len(temp))
#66
#RecursionError: maximum recursion depth exceeded in comparison