pythontutor.com

In class, a question about how you can debug your programs came up. I talked a little bit about things that debuggers have in common, and showed a bit about how you can use the debugger in Anaconda/Spyder, although I don’t have a great deal of experience with that debugger myself (so I immediately ran into the problem that I didn’t know what commands were available at the python debugger prompt).

But apparently when people are taught Python in CS classes, the site pythontutor.com is recommended as a troubleshooting resource. It looks pretty nice. For a short program, you can copy and paste it in, and then step through your program as it runs, line by line, to see how variables evolve.

I have not played with it really, I expect that while it will likely be useful for short functions that do not depend on NLTK, you’ll need to use a different debugger (like the one in Spyder) once you start using things that are not built into Python. (That is to say, for most things that require you to import <something> before using them.)

Still, it provides quite a nice visualization tool for simple things and can help you test your logic and see what is happening to your variables. I’ll see if I can come up with either some tutorials or documentation for the Spyder debugging functions. I haven’t looked for any at this point.

But, still, check out pythontutor.com if your functions aren’t doing what you think they should be.