Mastering PyCharm Transcripts
Chapter: Debugging Python applications
Lecture: Your turn: Debugging
0:01 When you're debugging your code
0:04 it's really important to have great tools to visualize
0:07 and understand exactly what's happening
0:09 and view the entire state of your app
0:11 and we saw the PyCharm debugger is pretty top-notch at that.
0:14 So let's go take an existing application
0:17 and use debugging to understand its workflow.
0:19 So over here in 7-debugging,
0:22 we've got math_tricks which is an existing little application that we're going to use
0:28 we come down here into the core,
0:30 this is the part we're going to try to understand
0:32 and what we have is we have two generator methods, this yield keywords
0:35 and generator methods are kind of weird
0:37 you can think of them as restartable or pause and resume these methods
0:43 so really, really cool in the way they work, really efficient
0:46 but also kind of funky to understand,
0:48 so what we are going to do is we're going to come down here
0:51 and open up this project, open this in PyCharm,
0:55 and we're going to run it just to make sure everything is hanging together
0:59 you should see something like this,
1:01 so we're going to play with breakpoints,
1:03 we're going to use the visual debugger to step through and understanding the code flow
1:06 and we're going to even alter the way the application runs
1:10 by changing some of its state,
1:12 which makes it go down different paths in the if block and things like that.
1:15 So, open up this project, these math tricks
1:18 and play with the debugger and see how it all works.