+ 1

Why is the recursion error so inconsistent?

So I know that if you try to execute an infinite recursion function, it'll throw a recursion error. However, I don't know why, if you set the recursion limit to about 23,810 or higher, you get a different, hard-to-read one. It isn't even consistent - it throws the normal error sometimes, and the cryptic one others. I also tried it on my Mac, but A. the recursion limit has to be around 30,000 (I forget the exact number), and B. it just straight up crashes. Why is this, and what does the cryptic error mean? https://code.sololearn.com/c436OG0moRJp/?ref=app

16th Jun 2020, 1:22 AM
Benjamin Richter
1 Resposta
+ 1
That is a very very rare occasion. That is the place where people realise that Python Interpreters are made in C. The "cryptic" message is not your fault but the Interpreter's fault. It is a Segmentation Fault. Which means that you are referring to a memory location outside the scope of your process. It depends on the system and how much memory is allocated to the process. P. S. Please avoid using recursions with Interpreted languages. It greatly increases the Space and Time Complexity and could be potentially dangerous to your system.
16th Jun 2020, 3:09 AM
Anubhav Mattoo
Anubhav Mattoo - avatar