Maximum level of recursion in Python

后端 未结 2 912
梦谈多话
梦谈多话 2020-12-08 14:59

What\'s the maximum level of recursion and how do I change it in Python?

2条回答
  •  余生分开走
    2020-12-08 15:04

    The default is 1000 levels deep and you can change that using the setrecursionlimit function in the sys module.

    Warning:

    Beware that some operating systems may start running into problems if you go much higher due to limited stack space.

提交回复
热议问题