[Tutor] debugging classes with a __setattr__ method

Lloyd Kvam pythontutor@venix.com
Tue, 09 Apr 2002 11:58:56 -0400


Yes, print works very nicely when all else fails.  I do have print statements
strategically placed.  However sometimes things just don't work right, but
there is no traceback and nothing suspicious in the print output.  I've found
the debugger very helpful for stepping through those cases.

dman wrote:

> On Mon, Apr 01, 2002 at 05:29:37PM -0500, Lloyd Kvam wrote:
> | I have a class for processing DataBase records that keeps a dictionary of 
> | the
> | actual field values from the database in a separate dictionary from the
> | Class's __dict__ dictionary.  When I try to step through the program using 
> | the
> | debugger,  I can no longer step into the called methods.  Deleting the
> | __setattr__ method restores normal debugging capabilities.
> | 
> | Is this a normal side effect on the debugger?  Very little of the code 
> | depends
> | on the __setattr__ method, so I can remove it, debug and then put it back.
> | However, there may be a better way.  Any suggestions?
> 
> Use 'print' :-).  It is the least invasive mechanism for debugging,
> and is nicely portable across languages and development environments.
> To date I've rarely used an actual debugger, and I've had projects in
> Eiffel, C++, C, Java, Python, and Perl.  Occaisonally a debugger is
> helpful (especially if you don't have any idea where a problem lies,
> or if you need a stack trace from a core dump), but sometimes
> (especially for multithreaded apps) it just can't do the job.
> 
> HTH,
> -D
> 
> 


-- 
Lloyd Kvam
Venix Corp.
1 Court Street, Suite 378
Lebanon, NH 03766-1358

voice: 
603-443-6155
fax: 
801-459-9582