Detecting recursion loops

Ben Finney bignose+hates-spam at benfinney.id.au
Wed Nov 29 17:59:00 EST 2006


robert <no-spam at no-spam-no-spam.invalid> 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 a counter somewhere, and
> > thus recalling a function with the same arguments again?
>
> the "bug" comes in from the I/O input.

If a program doesn't gracefully deal with bad input, that's a bug in
the program. You should be designing your input handler so that it
will do something helpful (even if that's to stop immediately with an
informative error message) in the event of bad input, rather than
allowing that bad data to send your program into an endless loop.

-- 
 \         "People's Front To Reunite Gondwanaland: Stop the Laurasian |
  `\           Separatist Movement!"  -- wiredog, http://kuro5hin.org/ |
_o__)                                                                  |
Ben Finney




More information about the Python-list mailing list