python解释器自动重启而不返回答案 [英] python interpretor automaticlly restarting without returning answer
问题描述
python解释器在调用递归函数时会自动重启有什么原因吗?我正在编写一个快速排序算法,并尝试对大量数字进行排序(顺序为 10^4),但是当我尝试对完整数组进行排序时,python 正在重新启动,即给我:
<块引用><块引用><块引用><块引用>============================== 重启 ================================
并且所有存储在内存中的值/函数都消失了.注意该代码适用于较小的值(<10^4).有没有因为递归量大而触发fail safe?
补充:python &空闲信息:
您最有可能在 IDLE 中收到此消息.在 IDLE 中,===RESTART==="只是 IDLE 刷新其先前代码的内存.
更新
如果您通过右键单击程序并选择Edit with IDLE"进入 IDLE,则不会出现这些 ====RESTART==== 消息;IDLE 以稍微不同的模式运行.但一切仍然有效.
在此处阅读有关 IDLE 的更多信息
Is there any reason why python interpretor will automatically restart when a recursive function is called? I'm programming a quick sort algorithm, and trying to sort a an large array of digits (order 10^4), but when I try to sort the full array python is restarting, i.e. giving me:
============================== RESTART ==============================
and all the values/functions stored in memory disappears. N.B. the code works fine for smaller values (<10^4). Is there fail safe been triggered due to the large amount of recursion?
added: python & IDLE info:
The most likely you got this message in IDLE. In IDLE, the "===RESTART===" is simply IDLE flushing its memory of the previous code.
UPDATE
If you entered IDLE by right-clicking on a program and choosing "Edit with IDLE," then these ====RESTART==== messages do not appear; IDLE is running in a slightly different mode. But everything still works.
Read here more about IDLE
这篇关于python解释器自动重启而不返回答案的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!