[Tutor] Debugging skills
ThreeBlindQuarks
threesomequarks at proton.me
Thu Jan 4 22:51:41 EST 2024
I would like to point out a debugging aspect above the REPL that I rarely see people use.
Take a programming environment like RSTUDIO that actually supports python and other languages too.
It lets you split the screen into multiple zones that include files you are editing and a window that shows the console they are running in that you can interact with. But an interesting one shows all your variables and their current values!
When you stop a python script at some level (and you can run it one expression at a time easily) you can pause and look at the variables of variables right there OR go to the console and type commands including ones that show the contents whatever way you want.
It is one thing to teach a LANGUAGE and another to teach an environment.
But many environments are made precisely to make some aspects of programming easier.
Another example would be variants of a Jupiter notebook. You create chunks of code. You can run them individually or run all of them up to a point. Obviously you can thus stop at various points and add a chunk to evaluate the state up to there.
And, of course, running under various debuggers and setting breakpoints, can produce valuable info.
A student of the language can then learn techniques that allow them to more rapidly figure out which small chunks of code are not doing what is expected and perhaps fix them.
The concept of writing all your code first and then debugging should be relegated to history.
Sent with Proton Mail secure email.
On Thursday, January 4th, 2024 at 8:46 PM, Alan Gauld via Tutor <tutor at python.org> wrote:
> On 04/01/2024 21:58, dn via Tutor wrote:
>
> > Prefacing these remarks with the comment that I don't (currently) teach
> > Python-from-scratch, nor for that matter, procedural coding from-scratch
> > (and why would I, given the wide-availability of materials?).
> >
> > Many of the issues-raised and under-lying themes, apply at a variety of
> > 'levels' of learning...
>
>
> I'm hoping to respond to this more thoroughly later (busy, busy!)
> but it strikes me that this (and several more of your recent posts)
> might be of greater interest on the Python Edu SIG? Are you a
> member of that community? They have a mailing list which is
> active but quiet.
>
> I don't mean you should not post this stuff here, just that
> the SIG has members who might be actively interested and are
> not on Tutor....
>
> > > > Interestingly the paper book version of my tutorial has a chapter on
> > > > debugging. However, I've never got round to adding that chapter
> > > > to the online version. I probably should...> +1
>
>
> OK, I'll add it to my list. I'm already working on a new book
> project(or more accurately resurrecting an old book project
> from 20 years ago!)
>
> > This ties-in with the above discussion because a casual look-around
> > reveals very few courses or books which start-off in the Python REPL
> > despite its characteristics of immediate-feedback
>
>
> Me, me! :-)
> The first 5 chapters/topics in my tutorial are all from the REPL.
> (Although 3 of those are really about concepts and getting Python
> installed ec!) I introduce the idea of an editor and saving your
> work in a file in chapter 6.
>
> But I do regularly refer back to the REPL as a way of testing
> functions and classes etc in later topics.
>
> > (whereas to quote Joni Mitchell, others don't know what they've got 'til
> > it's gone?)
>
>
> Now I'm humming along to "...put up a parking lot!"
>
> > Known unknowns: https://en.wikipedia.org/wiki/There_are_unknown_unknowns
> > A reasonably-readable article:
> > https://www.learning-mind.com/known-unknowns-unknown-unknowns/
>
>
> I always felt Rumsfeld got unfair criticism for that comment.
> He was absolutely correct in what he said. (Albeit using the
> statement of fact to blow a smokescreen over the Iraq question
> of the day) But it seems the journalists at the time just
> didn't get the concept!
>
> --
> 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
>
>
>
> _______________________________________________
> Tutor maillist - Tutor at python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
More information about the Tutor
mailing list