This is supposedly a problem with the IDLE editor for Python. (I'm running Python 3.3.0 on OSX, but the same problem occurs with 2.7.3)
I'm using IDLE to write Python programs. My problem is: Calling a recursive function, which calls itself too many times (1000 times), doesn't give me a single runtime error, but rather, it keeps sending me error messages until I close the program.
The error which it should be sending is: "RuntimeError: maximum recursion depth exceeded." The error which it sends a thousand times isntead is simply a point out to where in the script the problem is:
Traceback (most recent call last):
File "<pyshell#112>", line 1, in <module>
factorial(1.5)
File "/Users/User/Documents/Python/Scripts/program1.py", line 187, in factorial
recurse = factorial(n-1)
File "/Users/User/Documents/Python/Scripts/program1.py", line 187, in factorial
recurse = factorial(n-1)
etc.
This goes with all recursive functions calling itself too many times, but the specific function used here is:
def factorial(n):
if n == 0:
return 1
else:
recurse = factorial(n-1)
result = n * recurse
return result