June 2017
Beginner
352 pages
8h 39m
English
So, let's simply run the program. We have three tests that we expect to run, and since this is a relatively simple program we expect it run very quickly:
$ python palindrome.py
Instead of running quickly, we see that this program seems to run forever! And if you look at its memory usage, you'll also see that it grows in size the longer it runs. Clearly something is wrong, so let's use Ctrl+C to kill the program.
Let's use PDB to try to understand what's going on here. Since we don't know where our problem might lie, we don't know where to put a set_trace() call. So we're going to instead start the program under the control of PDB using a command-line invocation:
$ python -m pdb palindrome.py> /Users/sixty_north/examples/palindrome.py(1)<module>() ...
Read now
Unlock full access