idiom for debug code?
lbates at syscononline.com
Thu Sep 30 19:56:12 CEST 2004
Dan Perl wrote:
> Is there a mechanism or an idiom for adding code for debugging so that it
> can easily be removed in the production code? I am thinking of something
> similar to the C/C++ preprocessor statements with which you can compile an
> application with the debug code or without it (the default).
Personally I think you should consider NOT removing the debugging code.
It never ceases to amaze me how many times I must have a client run
the application with debug set so that the program logs details about
the running process and intermediate results. The output logfile can
then be easily emailed, faxed, etc. to me so that I can determine what
is REALLY the problem. The overhead of these if _debug: "type"
statements seems incredibly low compared to the ability to get this
information when needed. Just some thoughts based on my experience
of the last 30+ years.
More information about the Python-list