infinite recursion

Chad Netzer cnetzer at mail.arc.nasa.gov
Mon Nov 18 20:46:56 EST 2002


On Monday 18 November 2002 17:17, michael eng wrote:

> Anyway, is there a way in which I can remove the upper bound, such that
> the recursion depth is only limited by the constraints of the machine?

The problem being that the operating system may well decide to terminate your 
program (or perhaps your program will terminate the OS :), when you reach the 
"constraints of the machine".  I suspect the best you can do is set the limit 
as high as possible (on a 32 bit machine, that should be 2^31-1; do you 
REALLY recurse further down than that).  But, you must then somehow tell the 
operating system (BEFORE starting the python interpreter), to give your 
process an insane amount of stack.

But, beware of losing your calculations when your machine kills the process.  
You should definitely check out "Stackless Python", which could help 
ameliorate the problems to some extent.

-- 
Bay Area Python Interest Group - http://www.baypiggies.net/

Chad Netzer
cnetzer at mail.arc.nasa.gov




More information about the Python-list mailing list