r/pythontips • • Mar 24 '21

Python3_Specific How to debug in Python?

Please share some tips about the title.

32 Upvotes

38 comments sorted by

View all comments

7

u/Karam2468 Mar 24 '21

What does debugging do anyways? Newbie here. Why and when shoud we use it?

10

u/SHKEVE Mar 24 '21

It’s the process of “stepping through” code either in chunks or line by line and seeing what’s going on. Say you have a function that’s returning an unexpected value, you can go through each line of your function as it executes and watch what happens to your variables to catch where the error is.