How do you debug in Python? Coming from a Matlab and R user. I'm already aware of pdb.
Alan Gauld
alan.gauld at yahoo.co.uk
Wed Jan 27 18:39:35 EST 2021
On 27/01/2021 23:04, 2QdxY4RzWzUUiLuE at potatochowder.com wrote:
> systems are more painful than others, but yes, some debugging
> environments are more painful than others, too.
Very true! but a good debugger is a godsend. Howevder...
> A well placed call to print (they're not "print statements" anymore!)
> can be much more enlightening and much faster than single stepping
> through code in a debugger,
If you are single stepping more than 2 or 3 lines then you
aren't using the debugger properly!
Use breakpoints(selected by brain power!) and watches. The watches
are like print statements but don;t modify the source code
(nothing to remove later!)
Anytime I find myself hitting the step button more that a few
times I know I'm not using the debugger effectively and rethink.
> and seeing the output from the same print
> statement inside a loop can be much better than manually examining
> variables iteration after iteration and trying to remember what the
> value was before.
So don't do that, use the debugger. Most of them have conditional
breakpoints that will stop only when you need to.
> The best debugging tool, however, remains your brain.
Amen to that, regardless of any software tool used.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos
More information about the Python-list
mailing list