Python 中的最大递归级别 [英] Maximum level of recursion in Python

查看:42
本文介绍了Python 中的最大递归级别的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

递归的最高级别是多少?如何在 Python 中更改它?

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

推荐答案

默认为 1000 级深度,您可以使用 sys 模块中的 setrecursionlimit 函数更改它.

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

警告:

请注意,如果由于堆栈空间有限,某些操作系统可能会开始遇到问题.

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

这篇关于Python 中的最大递归级别的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆