Re: Detecting recursion loops

2006-12-02 Thread Kay Schluehr
Instead of threading a counter ( or an accumulator as for tail-recursive functions ) you can monitor the behaviour of the mutual recusive function call using an external stack and wrap the contributing functions using a decorator s.t. pushing and popping to and from the stack are pre- and postproce

Re: Detecting recursion loops

2006-12-01 Thread Fuzzyman
robert wrote: > My code does recursion loops through a couple of functions. Due to > problematic I/O input this leads sometimes to "endless" recursions and after > expensive I/O to the Python recursion exception. > What would be a good method to detect recursion loops and stop it by > user-Exce

Re: Detecting recursion loops

2006-12-01 Thread robert
Neil Cerutti wrote: > On 2006-12-01, robert <[EMAIL PROTECTED]> wrote: >> Ben Finney wrote: >>> robert <[EMAIL PROTECTED]> writes: >>> Carl Banks wrote: > 2. Consider whether you're unwittingly trying to cover up a bug. > ISTM no matter how problematic the input is, you should at least

Re: Detecting recursion loops

2006-12-01 Thread fumanchu
robert wrote: > Ben Finney wrote: > > robert <[EMAIL PROTECTED]> writes: > > > >> Carl Banks wrote: > >>> 2. Consider whether you're unwittingly trying to cover up a bug. > >>> ISTM no matter how problematic the input is, you should at least > >>> be able to make progress on it. Are you getting th

Re: Detecting recursion loops

2006-12-01 Thread Neil Cerutti
On 2006-12-01, robert <[EMAIL PROTECTED]> wrote: > Ben Finney wrote: >> robert <[EMAIL PROTECTED]> writes: >> >>> Carl Banks wrote: 2. Consider whether you're unwittingly trying to cover up a bug. ISTM no matter how problematic the input is, you should at least be able to make progr

Re: Detecting recursion loops

2006-12-01 Thread robert
Ben Finney wrote: > robert <[EMAIL PROTECTED]> writes: > >> Carl Banks wrote: >>> 2. Consider whether you're unwittingly trying to cover up a bug. >>> ISTM no matter how problematic the input is, you should at least >>> be able to make progress on it. Are you getting this error >>> because, say,

Re: Detecting recursion loops

2006-11-29 Thread Ben Finney
robert <[EMAIL PROTECTED]> writes: > Carl Banks wrote: > > 2. Consider whether you're unwittingly trying to cover up a bug. > > ISTM no matter how problematic the input is, you should at least > > be able to make progress on it. Are you getting this error > > because, say, you're not incrementing

Re: Detecting recursion loops

2006-11-29 Thread John Machin
robert wrote: > > the "bug" comes in from the I/O input. > Have you considered checking your input for valid values? Cheers, John -- http://mail.python.org/mailman/listinfo/python-list

Re: Detecting recursion loops

2006-11-29 Thread robert
Carl Banks wrote: > robert wrote: >> My code does recursion loops through a couple of functions. Due to >> problematic I/O input this leads sometimes to "endless" recursions and after >> expensive I/O to the Python recursion exception. >> What would be a good method to detect recursion loops and

Re: Detecting recursion loops

2006-11-29 Thread robert
Rob Wolfe wrote: > robert wrote: >> My code does recursion loops through a couple of functions. Due to >> problematic I/O input this leads sometimes to "endless" recursions and after >> expensive I/O to the Python recursion exception. >> What would be a good method to detect recursion loops and s

Re: Detecting recursion loops

2006-11-29 Thread Bytter
Hi! I hope you are not trying to find infinite loops and I simply misunderstood your question. Because if you are, then forget it (Turing anyone?)... Infinite loops are impossible to find (minus some few, very specific situations). Cf. http://en.wikipedia.org/wiki/Halting_problem Cheers, Hugo F

Re: Detecting recursion loops

2006-11-29 Thread Carl Banks
robert wrote: > My code does recursion loops through a couple of functions. Due to > problematic I/O input this leads sometimes to "endless" recursions and after > expensive I/O to the Python recursion exception. > What would be a good method to detect recursion loops and stop it by > user-Excep

Re: Detecting recursion loops

2006-11-29 Thread Rob Wolfe
robert wrote: > My code does recursion loops through a couple of functions. Due to > problematic I/O input this leads sometimes to "endless" recursions and after > expensive I/O to the Python recursion exception. > What would be a good method to detect recursion loops and stop it by > user-Exce