Presentation is loading. Please wait.

Presentation is loading. Please wait.

Debuggers in Python. The Debugger Every programming IDE has a tool called a debugger. This application does NOT locate or fix your bugs for you! It slows.

Similar presentations


Presentation on theme: "Debuggers in Python. The Debugger Every programming IDE has a tool called a debugger. This application does NOT locate or fix your bugs for you! It slows."— Presentation transcript:

1 Debuggers in Python

2 The Debugger Every programming IDE has a tool called a debugger. This application does NOT locate or fix your bugs for you! It slows the program down by letting you ‘single-step’ through it You can check your understanding of the code as it goes by It shows you the variables that are created and their values It shows you the call stack of function calls that have been done

3 Breakpoints In order to step through your program one statement at a time, you must first set a breakpoint. If your program is a straight sequence, you may need only one. If you have branches and loops, you may need several to make sure the execution does actually hit one. When the program is running under the Debugger, it will run normally (at normal speed) until a breakpointed statement is about to execute. Then the interpreter gives control to you the programmer, it pauses the program and shows the current state of the program.

4 Stepping Step Over (Over in IDLE) “the next statement to execute has a function call in it, I do NOT want to see the details of that call. Just do the call and pause at the next statement” Step Into (Step in IDLE) “The next statement to execute has a function call in it, I DO want to see the details of that call. Get to the top of the function definition and pause” Step Out of (Out in IDLE) “I have stepped into a function which I did not meant to. Please finish the function call quickly and then pause”

5 Watch window For your debugger, check to see where the watch window is That is where the variables are shown as they are defined and destroyed Their value is shown, usually their type When you step through a statement, watch this window to see how a variable changes In IDLE the window is labeled “Locals” In WingIDE it is labeled “Stack Data”

6 Call stack This keeps track of the current function call In WingIDE it is a window usually to the right which grows downward as more functions are called In IDLE it is the list of statements that is in the main Debug window, it also grows downward as more functions are called – it is NOT labeled “call stack”


Download ppt "Debuggers in Python. The Debugger Every programming IDE has a tool called a debugger. This application does NOT locate or fix your bugs for you! It slows."

Similar presentations


Ads by Google