[Tutor] Useful blog post: How to debug small programs

Jerry Hill malaclypse2 at gmail.com
Wed May 7 19:09:47 CEST 2014


On Wed, May 7, 2014 at 6:50 AM, Walter Prins <wprins at gmail.com> wrote:
> Hi all,
>
> I stumbled across this post today and thought it was worth sharing
> with the Python tutor list.  It provides good advice to students about
> debugging your programs and how to ask for help on forums, in
> particular Stack overflow, but in that way equally applies to the
> Python tutor list.
>
> Link: http://ericlippert.com/2014/03/05/how-to-debug-small-programs/

That's a pretty good primer on debugging, especially for school
assignments which tend to be short and well defined.

I like to point people towards this page too: http://www.sscce.org/

That's more geared to how to get your questions answered on a mailing
list (I assume it works equally well for stack overflow).  Basically,
the advice boils down to taking the code you're having problems with
and cutting it down to a Short, Self Contained, Compilable Example.
The key is that the code should be short enough to read comfortably,
self contained enough that I could copy and paste it into an editor,
run the code, and see exactly what you're having problems with.  The
compilable part isn't so important in python, but the code ought to
run, without throwing Syntax Errors, unless that syntax error is what
you're asking about.

As it happens, the process of cutting your code down to that example
often points you to where your problem is without even having to post.
 When it doesn't, you're able to put a compelling question in front of
volunteers on your mailing list or forum of choice.  I know I am much,
much more likely to comment on code that fits these guidelines.

-- 
Jerry


More information about the Tutor mailing list